need help regarding compilation
i am new to learning jython... i just tried compiling a small piece of code that is given below: def fac(x) if x<=1:return 1 return x*fac(x-1) on C:\Program Files\jython\temp>jythonc factor.py it showed the following error: processing factor Traceback (innermost last): File "C:\Program Files\jython\Tools\jythonc\jythonc.py", line 5, in ? File "C:\Program Files\jython\Tools\jythonc\main.py", line 298, in main File "C:\Program Files\jython\Tools\jythonc\main.py", line 219, in doCompile File "C:\Program Files\jython\Tools\jythonc\compile.py", line 195, in compilef ile File "C:\Program Files\jython\Tools\jythonc\compile.py", line 209, in compile File "C:\Program Files\jython\Tools\jythonc\SrcGenCompiler.py", line 1079, in execstring File "", line 1 def fac(x) ^ SyntaxError: invalid syntax What may have gone wrong? I am totally clueless as it is not mentioned in any of the books that I tried. -- http://mail.python.org/mailman/listinfo/python-list
Re: need help regarding compilation
> > Try this: > > def fac(x): > if x<=1:return 1 > return x*fac(x-1) I am still getting an error in compilation. Would be really thankful if someone could tell me as to what is going wrong. processing factor Required packages: Creating adapters: Creating .java files: factor module Compiling .java to .class... Compiling with args: ['C:\\Program Files\\Java\\jre1.6.0\\bin\\javac', '-classpa th', 'C:\\Program Files\\jython123\\jython.jar;;.\\jpywork;;C:\\Program Files\\j ython123\\Tools\\jythonc;C:\\PROGRA~1\\JYTHON~1\\src\\.;C:\\Program Files\\jytho n123\\Lib;C:\\Program Files\\jython123', '.\\jpywork\\factor.java'] 1 java.io.IOException: CreateProcess: "C:\Program Files\Java\jre1.6.0\bin\javac " -classpath "C:\Program Files\jython123\jython.jar;;.\jpywork;;C:\Program Files \jython123\Tools\jythonc;C:\PROGRA~1\JYTHON~1\src\.;C:\Program Files\jython123\L ib;C:\Program Files\jython123" .\jpywork\factor.java error=2 Consider using the -C/--compiler command line switch, or setting the property python.jythonc.compiler in the registry. ERROR DURING JAVA COMPILATION... EXITING -- http://mail.python.org/mailman/listinfo/python-list
Re: need help regarding compilation
> You really have a book about python that doesn't mention that functions > definitions are closed by a colon? I doubt that... It is not python but jython. But I dont think that the syntax of both of them are different. I managed to download the tutorial of jython from the IBM website. I am wondering as to how they could put in wrong syntaxes in their tutorials !! -- http://mail.python.org/mailman/listinfo/python-list
Re: need help regarding compilation
Kent Johnson wrote: > fidlee wrote: > >>Try this: > >> > >>def fac(x): > >> if x<=1:return 1 > >> return x*fac(x-1) > > > > > > I am still getting an error in compilation. Would be really thankful if > > someone could tell me as to what is going wrong. > > Try running the compiler under Java 1.4, or just run the class in the > jython interpreter without compiling it first. For simple examples like > this you don't need to compile, just run it with >jython factor.py > > Kent Thanks. i noticed that it runs. But why is it throwing a compilation error in my case here? -- http://mail.python.org/mailman/listinfo/python-list