Message794

Author lmjohns3
Recipients
Date 2002-11-29.10:15:50
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I am working on an i686 GNU/Linux system with Sun's JDK
1.4.1, Python 2.2.2, and Jython 2.1.

I have written a Jython package that I wish to test
before installing. The file structure is generally as
follows :

work/
+ __init__.py
+ mysubpackage/
|  + __init__.py
|  ` mysubmodule.py
+ otherdir1/
` otherdir2/

(Sorry for the bad ASCII art ; I hope you can read the
structure anyway.) I want to import the package rooted
at "work" under the name "mypackage". The mypackage
init script essentially just imports the underlying
subpackage ; that is, work/__init__.py contains "from
mysubpackage import *". Using CPython I can do the
following :

$ cd work
$ ln -s . mypackage
$ python
Python 2.2.2 (#1, Nov 21 2002, 08:18:14) 
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import mypackage
>>>

But if I try the same with jython, here is what I get :

$ cd work
$ ln -s . mypackage
$ jython
Jython 2.1 on java1.4.1 (JIT: null)
Type "copyright", "credits" or "license" for more
information.
>>> import mypackage
Traceback (innermost last):
  File "<console>", line 1, in ?
ImportError: no module named mypackage
>>>

If, instead, I physically copy all the appropriate
source files to a physical directory called
"mypackage", then the import works fine with both
standard Python and Jython.

I hope this helps!
History
Date User Action Args
2008-02-20 17:17:12adminlinkissue645615 messages
2008-02-20 17:17:12admincreate