Problem with Packages

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 8 03:50:16 EST 2007


En Thu, 08 Mar 2007 05:26:45 -0300, Srikanth <sri1025 at gmail.com> escribió:

>> It appears that you forgot the basic rule: a package is a directory with
>> an __init__.py file (even if empty).
>
> Exactly right. I didn't know that __init__.py is a mandatory one.
> Thanks for pointing out.

You may want to review this section on the Python Tutorial, covering  
packages:  
http://docs.python.org/tut/node8.html#SECTION008400000000000000000

>> You need 4 of such files here.
>
> Thanks again for saying 4, cause I would have definetly put only 2
> (inside dir1_1 and dir2_2)

That was absolutely intentional :) so you had to figure out *where* to put  
the __init__.py files...

>> Maybe PyDev plays some tricks with PYTHONPATH or something...
>>
> I got the same doubt and I checked PyDev before posting, the
> PYTHONPATH is exactly the same but I didn't notice or rather
> overlooked __init__.py file it created automatically when I created
> packages using the dialogs.

Ah, those automagical tools...

> Thanks you Gabriel!

I'm glad you found it helpful!

-- 
Gabriel Genellina




More information about the Python-list mailing list