[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: package import

Steve Holden

2/6/2008 4:53:00 AM

Sean Allen wrote:
> ok, what am i doing wrong?
>
> in current working directory i have:
>
> t.py
> sub/t1.py
>
> t.py is:
>
> import sub.t1
>
> i get:
>
> ImportError: No module named sub.t1
>
> t.py is
>
> import sub
>
> i get:
>
> ImportError: No module named sub.t1
>
> --
>
> i am obviously missing something really basic here.
> have tried on multiple machines, linux and mac os x.
>
Create an empty sub/__init__.py - then Python will recognize sub is a
package, and allow you to import modules from within it.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.hold...