From: John C. <joh...@xa...> - 2015-09-23 18:18:27
|
Hi, I am currently working on a web application which allows user to upload/run python script in web application. I copied jython-standalone-2.7.0.jar to WEB-INF/lib and build web application as war file. however, I get a following error when running a python script: org.python.core.PyException: null at org.python.core.Py.ImportError(Py.java:328) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.imp.import_first(imp.java:877) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.imp.import_module_level(imp.java:972) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.imp.importName(imp.java:1062) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.ImportFunction.__call__(__builtin__.java:1280) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.PyObject.__call__(PyObject.java:431) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.__builtin__.__import__(__builtin__.java:1232) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.imp.importOne(imp.java:1081) ~[jython-standalone-2.7.0.jar!/:na] at org.python.pycode._pyx18.f$0(<script>:11) ~[na:na] at org.python.pycode._pyx18.call_function(<script>) ~[na:na] at org.python.core.PyTableCode.call(PyTableCode.java:167) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.PyCode.call(PyCode.java:18) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.Py.runCode(Py.java:1386) ~[jython-standalone-2.7.0.jar!/:na] at org.python.core.Py.exec(Py.java:1430) ~[jython-standalone-2.7.0.jar!/:na] at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276) ~[jython-standalone-2.7.0.jar!/:na] at com.xactly.xsql.expression.arithmetic.ProcedureScalarOp.allocate(ProcedureScalarOp.java:92) ~[xsql-0.9.99-SNAPSHOT.jar!/:na] I found a workaround by running jython installer and setting python.home by specifying -Dpython.home=<jython install directory> as a JVM parameter. I think the purpose of using jython-standalone-2.7.0.jar is to be able to run jython without running installer. How do I specify jython-standalone-2.7.0.jar as python.home? I think somehow it needs Lib directory which is inside of jar. Any recommendations are appreciated. Thanks John On Tue, Sep 22, 2015 at 3:49 PM, John Chiang <joh...@xa...> wrote: > Hi, > > I am currently working on a web application which allows user to > upload/run python script in web application. I copied > jython-standalone-2.7.0.jar to WEB-INF/lib and build web application as war > file. however, I get a following error when running a python script: > > org.python.core.PyException: null > > at org.python.core.Py.ImportError(Py.java:328) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.imp.import_first(imp.java:877) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.imp.import_module_level(imp.java:972) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.imp.importName(imp.java:1062) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.ImportFunction.__call__(__builtin__.java:1280) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.PyObject.__call__(PyObject.java:431) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.__builtin__.__import__(__builtin__.java:1232) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.imp.importOne(imp.java:1081) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.pycode._pyx18.f$0(<script>:11) ~[na:na] > > at org.python.pycode._pyx18.call_function(<script>) ~[na:na] > > at org.python.core.PyTableCode.call(PyTableCode.java:167) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.PyCode.call(PyCode.java:18) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.Py.runCode(Py.java:1386) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.core.Py.exec(Py.java:1430) > ~[jython-standalone-2.7.0.jar!/:na] > > at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276) > ~[jython-standalone-2.7.0.jar!/:na] > > at > com.xactly.xsql.expression.arithmetic.ProcedureScalarOp.allocate(ProcedureScalarOp.java:92) > ~[xsql-0.9.99-SNAPSHOT.jar!/:na] > > > I found a workaround by running jython installer and setting python.home > by specifying -Dpython.home=<jython install directory> as a JVM parameter. > I think the purpose of using jython-standalone-2.7.0.jar is to be able to > run jython without running installer. > > How do I specify jython-standalone-2.7.0.jar as python.home? I think > somehow it needs Lib directory which is inside of jar. > > > Any recommendations are appreciated. Thanks > -- [image: What's New with Xactly] <http://www.xactlycorp.com/email-click/> <https://www.nyse.com/quote/XNYS:XTLY> [image: LinkedIn] <https://www.linkedin.com/company/xactly-corporation> [image: Twitter] <https://twitter.com/Xactly> [image: Facebook] <https://www.facebook.com/XactlyCorp> [image: YouTube] <http://www.youtube.com/xactlycorporation> |