jython problem importing a py file

  • Thread starter didier.prophete
  • Start date
D

didier.prophete

Ok, so I know this is probably a common jython error, but somehow I
can't seem to find an answer to this trivial problem.

Ok, I have the following (simple) directory structure:
$TOP/
__init__.py
py_dir/
__init__.py
util.py

I have:
PYTHONPATH=$TOP
CLASSPATH=$TOP

I am now trying to execute the simple python/jython statement: "import
py_dir.util"
If I do a 'cd $TOP' first, then this works fine in python and jython.

But if I do a 'cd $TOP/py_dir', then it still works fine in python, but
jython gives me:
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: No module named util

I tried everything I could think of (playing with the __init__.py, the
PYTHONCLASS, the CLASSPATH), but nothing seems to work...

I am doing something wrong here ?

-Didier
 
K

Khalid Zuberi

I tried everything I could think of (playing with the __init__.py, the
PYTHONCLASS, the CLASSPATH), but nothing seems to work...

I am doing something wrong here ?

-Didier

Take a look at the jython registry setting python.path:

http://www.jython.org/docs/registry.html

So if you invoke jython with say:

jython -Dpython.path=$TOP

your import should work.

- kz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top