|
From: John F. <jfa...@mi...> - 2001-03-28 07:01:51
|
Hi guys! I am trying to embed Jython in a large multi-tier Java app. I am
trying to figure out what I have to do to get it to pick up the python.path
setting from the registry. What I have done so far is:
* change the registry to say:
python.path = f:\\jython-2.1a1\\lib
* the registry is f:\jython-2.1a1\registry
* pass -Dpython.home=f:\jython-2.1a1 as a command line arg to the app
* instantiate a PythonInterpreter
* put my library, "minestar_admin.py" into f:\jython-2.1a1\lib.
Now, my theory on how it should work is that when I instantiate
PythonInterpreter it looks in the system properties for the python.home
setting. Then it looks in that directory for the file 'registry'. Then it
loads that file, giving it a value for python.path. Then it looks along
that path to resolve things. However, when I exec the line
import minestar_admin
I get:
Traceback (innermost last):
File "<string>", line 1, in ?
NameError: minestar_admin
at org.python.core.Py.NameError(Py.java:134)
at org.python.core.PyFrame.getglobal(PyFrame.java:166)
at org.python.core.PyFrame.getname(PyFrame.java:146)
at org.python.pycode._pyx0.f$0(<string>)
at org.python.pycode._pyx0.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.Py.runCode(Py.java:965)
at org.python.core.__builtin__.eval(__builtin__.java:241)
at org.python.core.__builtin__.eval(__builtin__.java:245)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:102)
which suggests to me that PythonInterpreter can't find the file. Could
someone please tell me what is wrong with my hypothesis above? I read
the Javadoc for PythonInterpreter, and it said:
>public class PythonInterpreter extends java.lang.Object
>
>The PythonInterpreter class is a standard wrapper for a JPython interpreter for use embedding in a Java >application.
>
>Version: 1.0, 02/23/97 <---------------------- I think there is a problem.
>Author: Jim Hugunin
Thanks for any help.
John
--
Dr John Farrell - Research Architect - Mincom Limited
I don't suffer from stress, I suffer from idiots.
----------------------------- Mincom wants no credit for anything I say:
This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please delete
it and notify the sender. The contents of this E-mail are the opinion of the
writer only and are not endorsed by Mincom Limited unless expressly stated
otherwise.
|