Message1702
A simple python package with one module is created:
/Users/mgreenberg/myDir/tena/__init__.py
/Users/mgreenberg/myDir/tena/foo.py
The first listing shows that although /Users/mgreenberg/myDir is in the CLASSPATH, the module tena is not found. The second to last line of the trace seems to indicate that jython is looking in the classpath:
import: trying source __classpath__/tena
But it does not find it. If /Users/mgreenberg/myDir
is explicitly added to the python.path, everything works.
------------ /Users/mgreenberg/myDir is in CLASSPATH, but tena.foo is not found on import -----------
tamale:~/inf/jython mgreenberg$ java -Djython.cachedir=/tmp/cachedir -Dpython.home=/tmp/.install/jython-v2.2.0.rc1 -classpath '/tmp/.install/jython-v2.2.0.rc1/jython.jar:/Users/mgreenberg/myDir' org.python.util.jython -v -v
<snip>
Jython 2.2rc1 on java1.5.0_07
<snip>
Type "copyright", "credits" or "license" for more information.
<file-top>:
>>> import sys,os
<single-top>: os= sys=
>>> sys.path
<single-top>: sys
['', '/tmp/.install/jython-v2.2.0.rc1/Lib', '__classpath__']
>>> import java.lang.System
<single-top>: java=
>>> java.lang.System.getProperty('java.class.path')
<single-top>: java
'/tmp/.install/jython-v2.2.0.rc1/jython.jar:/Users/mgreenberg/myDir:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/.compatibility/14compatibility.jar'
>>> import tena.foo
<single-top>: tena=
import: trying source /Users/mgreenberg/inf/jython/tena
import: trying precompiled with no source/Users/mgreenberg/inf/jython/tena$py.class
import: trying source /tmp/.install/jython-v2.2.0.rc1/Lib/tena
import: trying precompiled with no source/tmp/.install/jython-v2.2.0.rc1/Lib/tena$py.class
import: trying tena in packagemanager for path None
import: trying tena as java class in syspath loader
import: trying source __classpath__/tena
import: trying precompiled with no source__classpath__/tena$py.class
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named tena
-------------- When /Users/mgreenberg/myDir explicitly added to python.path, module tena.foo is located ------
java -Dpython.path='/Users/mgreenberg/myDir' -Djython.cachedir=/tmp/cachedir -Dpython.home=/tmp/.install/jython-v2.2.0.rc1 -classpath '/tmp/.install/jython-v2.2.0.rc1/jython.jar:/Users/mgreenberg/myDir' org.python.util.jython -v -v
<snip>
Jython 2.2rc1 on java1.5.0_07
<snip>
Type "copyright", "credits" or "license" for more information.
<file-top>:
>>> import sys,os
<single-top>: os= sys=
>>> sys.path
<single-top>: sys
['', '/tmp/.install/jython-v2.2.0.rc1/Lib', '/Users/mgreenberg/myDir', '__classpath__']
>>> import tena.foo
<single-top>: tena=
import: trying source /Users/mgreenberg/inf/jython/tena
import: trying precompiled with no source/Users/mgreenberg/inf/jython/tena$py.class
import: trying source /tmp/.install/jython-v2.2.0.rc1/Lib/tena
import: trying precompiled with no source/tmp/.install/jython-v2.2.0.rc1/Lib/tena$py.class
import: trying precompiled /Users/mgreenberg/myDir/tena/__init__$py.class
import: 'tena' as /Users/mgreenberg/myDir/tena/__init__.py
import: trying source /Users/mgreenberg/myDir/tena/foo
import: trying precompiled /Users/mgreenberg/myDir/tena/foo$py.class
import: 'tena.foo' as /Users/mgreenberg/myDir/tena/foo.py
>>> |
|
Date |
User |
Action |
Args |
2008-02-20 17:17:53 | admin | link | issue1747126 messages |
2008-02-20 17:17:53 | admin | create | |
|