PYTHONPATH problems

Fredrik Lundh fredrik at pythonware.com
Thu Nov 20 05:13:23 EST 2003


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>








More information about the Python-list mailing list