PYTHONPATH problems
Tim Isakson
loiosh13 at yahoo.com
Thu Nov 20 08:25:42 EST 2003
On Thu, 20 Nov 2003 11:13:23 +0100, Fredrik Lundh wrote:
> Tim Isakson wrote:
>
>> However, it isn't finding any of the modules in the directory tree that
>> begins under /home/tim/python/PP/Examples (it's not having any problems
>> with the standard modules - as evidenced by the import of sys above).
>
> "sys" is a built-in module; Python finds that one without even looking at
> the path.
>
>> I'm at a loss - any thoughts on what I'm doing incorrectly?
>>
>> Thanks for any assistance!
>
> running Python with the "-vv" flag might provide you with some additional
> clues:
>
> $ python -vv
> >>> import mymodule
> # trying mymodule.so
> # trying mymodulemodule.so
> # trying mymodule.py
> # trying mymodule.pyc
> # trying /mysystem/lib/python2.1/mymodule.so # trying
> /mysystem/lib/python2.1/mymodulemodule.so /.../
> # trying /mysystem/lib/python2.1/site-packages/PIL/mymodule.py #
> trying /mysystem/lib/python2.1/site-packages/PIL/mymodule.pyc
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ImportError: No module named mymodule
>
> (also note that you must have read access to the scripts; if Python cannot
> read a file, it treats it as if it didn't exist)
>
> </F>
Thanks for the -vv flag tip - it helped some.
Sadly (for me, at least), the problem turned out to be user error - I was
using BASH syntax for the path while within Python, and needless to say,
that didn't do the trick.
Once I changed the imports to use '.' as the delimiter, things worked
fine.
Thanks for your assistance!
Tim
More information about the Python-list
mailing list