From: Charlie G. <cha...@gm...> - 2008-11-22 23:35:21
|
On Thu, Nov 20, 2008 at 8:50 AM, <Amm...@su...> wrote: > I found about this Interface (Java) and Implementation (Jython) from > http://wiki.python.org/jython/JythonMonthly/Articles/October2006/3 and > http://wiki.python.org/jython/JythonMonthly/Articles/September2006/1 > > and tried to implement it. Finally when I was done I got the error that > "ImportError: no module named Employee" > > > > Now Employee in this case is the Jython Implementation of Java Interface. I > am having trouble putting my files in proper order and even though I have > put the Employee.py folder in Eclipse's PYTHONPATH I can't get it through. The environmental variable for sys.path is JYTHONPATH in Jython to avoid stepping on CPython's toes. You can also set the python.path property when initializing your PythonInterpreter. Also, if you're following the examples, the Employee class is in a file named employee.py. That means if the directory containing employee.py is on your JYTHONPATH, you'll need use "from employee import Employee" to get to the class. It's contained in the employee module, not exposed directly like a Java class. If that still doesn't work, try importing sys and printing out sys.path in your Python code before importing employee. That will let you see where Python is importing from and if it's missing your modules. Charlie |