Message5455
Thanks for responding Frank. I actually just tried 3 different methods of calling/importing python from within Java. You can view what I tested here: http://gist.github.com/286908
For my simple test case, using Jython 2.5.1 worked as expected. :)
I also tried Jython 2.5.0, which, aside from not having the interpreter.compile() method, did NOT work. So, it looks like the problem I was having in Jython 2.5.0 were fixed since then. Jython 2.5.0 gives this error stacktrace:
Execing: test.py
0.0715102502628
Traceback (most recent call last):
File "test.py", line 9, in <module>
run()
File "test.py", line 6, in run
print Utils2.randomString(10)
LookupError: no codec search functions registered: can't find encoding
at org.python.core.PyException.fillInStackTrace(PyException.java:70)
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.Exception.<init>(Exception.java:29)
at java.lang.RuntimeException.<init>(RuntimeException.java:32)
at org.python.core.PyException.<init>(PyException.java:46)
at org.python.core.PyException.<init>(PyException.java:43)
at org.python.core.PyException.<init>(PyException.java:61)
at org.python.core.codecs.lookup(codecs.java:80)
at org.python.core.codecs.getEncoder(codecs.java:209)
at org.python.core.codecs.encode(codecs.java:187)
at org.python.core.PyString.str_encode(PyString.java:2429)
at org.python.core.PyString.encode(PyString.java:2424)
at org.python.core.StdoutWrapper.print(StdoutWrapper.java:111)
at org.python.core.StdoutWrapper.println(StdoutWrapper.java:203)
at org.python.core.Py.println(Py.java:1329)
at org.python.pycode._pyx0.run$1(test.py:6)
at org.python.pycode._pyx0.call_function(test.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:117)
at org.python.core.PyFunction.__call__(PyFunction.java:307)
at org.python.pycode._pyx0.f$0(test.py:9)
at org.python.pycode._pyx0.call_function(test.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1197)
at org.python.core.__builtin__.execfile_flags(__builtin__.java:538)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:156)
at gist.JythonTest.runFile(JythonTest.java:25)
at gist.JythonTest.main(JythonTest.java:84 |
|
Date |
User |
Action |
Args |
2010-01-26 15:46:04 | tzellman | set | messageid: <1264520764.98.0.145251147423.issue1383@psf.upfronthosting.co.za> |
2010-01-26 15:46:04 | tzellman | set | recipients:
+ tzellman, fwierzbicki |
2010-01-26 15:46:04 | tzellman | link | issue1383 messages |
2010-01-26 15:46:03 | tzellman | create | |
|