Hi,

We have deployed the jython 2.5.1 jar file that we have created at installation. We have a small framework where the users can write jython code. However, when I was just adding the jython.jar to build path as external library all was working well.

After that we added that jar file to our local maven repository, then we start to get problems. It cannot find the “re” package. Here is the complete error output. It seems like I need to specify where the modules are located, but how to do that for the script engine?

Any help or hint would be happily received.

/Peter


--------


2010-08-25 19:09:55,223 2072 ERROR (main) PythonParser.parse:91 - Error while running the code:
# for regular expressions
import re

match = re.search(‘a’, “qwedas”)

javax.script.ScriptException: ImportError: No module named re in <script> at line number 2
    at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:182)
    at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:43)
    at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:33)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
    at com.nsn.pc.rebus.parser.impl.python.PythonParser.parse(PythonParser.java:88)
    at com.nsn.pc.rebus.parser.impl.python.PythonParserTest.simple(PythonParserTest.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
    at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: Traceback (most recent call last):
  File "<script>", line 2, in <module>
ImportError: No module named re

    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.Py.ImportError(Py.java:264)
    at org.python.core.imp.import_first(imp.java:672)
    at org.python.core.imp.import_name(imp.java:756)
    at org.python.core.imp.importName(imp.java:806)
    at org.python.core.ImportFunction.__call__(__builtin__.java:1232)
    at org.python.core.PyObject.__call__(PyObject.java:367)
    at org.python.core.__builtin__.__import__(__builtin__.java:1202)
    at org.python.core.__builtin__.__import__(__builtin__.java:1185)
    at org.python.core.imp.importOne(imp.java:817)
    at org.python.pycode._pyx0.f$0(<script>:6)
    at org.python.pycode._pyx0.call_function(<script>)
    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:1204)
    at org.python.core.__builtin__.eval(__builtin__.java:504)
    at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:164)
    at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:41)
    ... 30 more