Setting PYTHONPATH does not allow importing module

liuerfire Wang liuerfire at gmail.com
Tue Mar 3 22:37:40 EST 2015


Is there a file named __init__.py in the modulename dir?

Best regards


On Wed, Mar 4, 2015 at 11:25 AM, <faruk at vt.edu> wrote:

> I have the following directory /home/me/projects/modulename.
>
> I update PYTHONPATH using the following command:
> export PYTHONPATH=$PYTHONPATH:/home/me/projects/modulename
>
> It seems to have been added:
> [me at machine ~]$ python -c "import sys; print(sys.path)"
> ['',... '/home/me', '/home/me/projects/modulename', ...]
>
> But import modulename does not work:
> [me at machine ~]$ python -c "import modulename"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> ImportError: No module named modulename
>
> Does anyone know what's wrong?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150304/5c7bf82b/attachment.html>


More information about the Python-list mailing list