From: <Amm...@su...> - 2008-11-24 09:04:56
|
Hi Ok So how to set the path??? If I add the path in command prompt (sys.path.append) it only stays there for session and goes away as soon as I close If I add a variable named "JYTHONPATH" in environment variables and set the "Lib" and home folder of jython along with my personal package folders it doesn't show up in sys.path and neither in Eclipse java project. There is no option as JYTHONPATH for jython in Eclipse like PYTHONPATH for Pydev so I try adding my Employee folder in the classpath of Jython through preferences. None of the above is working for me. How hard can it be to add a module ????? Regards Ammar Hassan Sungard - Stockholm, Sweden +46 08 4540 309 -----Original Message----- From: Charlie Groves [mailto:cha...@gm...] Sent: den 23 november 2008 00:35 To: Hassan, Ammar Cc: jyt...@li... Subject: Re: [Jython-users] Using Jython from Java 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 |