|
Re: [Jython-users] Importing a python script and evaluating it
using another python script, using jython
From: Alan Kennedy <jython-users@xh...> - 2008-03-26 08:50
|
[Heshan]
> Finally I manually copied the two python scripts to the following
> classpath
>
> /home/heshan/Installations/jython_installer-2.2.1/Lib
Don't do that, otherwise you'll be making things difficult for yourself.
> Then the java code executed properly.But the problem now I am having is
> that every time if I introduce a new python module I must copy it to the
> classpath.
As I mentioned yesterday, use the setting of the "python.path"
variable in the jython registry. Add the directory containing your
jython files to the value of the python.path variable, like this
python.path = /home/heshan/my_modules/
Or wherever your modules live.
> Is there a better way that I can do this programatically?
You should not need to do that in these circumstances, if you get your
environment set up properly.
But there can be circumstances where the contents of path can only be
set at runtime. In those cases, it is done like this
import sys
sys.path.append("/home/heshan/my_modules")
Alan.
|
| Thread | Author | Date | |
|---|---|---|---|
| [Jython-users] Importing a python script and evaluating it using another python script, using jython | Heshan Suriyaarachchi <heshan.suri@gm...> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|