Problem with Packages

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 8 01:13:49 EST 2007


En Thu, 08 Mar 2007 02:37:51 -0300, Srikanth <sri1025 at gmail.com> escribió:

> I am learning about Python packages and I am getting an ImportError
> but I can't figure out the reason why.

It appears that you forgot the basic rule: a package is a directory with  
an __init__.py file (even if empty).

> I have three modules and they are stored in a directory hierarchy as:
>
> my_apps
> |
> |--> mod3.py
> |--> dir1/dir1_1/mod1.py
> |--> dir2/dir2_2/mod2.py

You need 4 of such files here.

> And the directory my_apps is included in PYTHONPATH environment
> variable, what am I doing wrong? I executed this code under PyDev and
> it's working perfectly but when I run it outside of PyDev, it fails.

Maybe PyDev plays some tricks with PYTHONPATH or something...

-- 
Gabriel Genellina




More information about the Python-list mailing list