Where to put data

bvdp bob at mellowood.ca
Wed Jan 25 17:27:16 EST 2012

> I would not put anything in the toplevel Python folder. You need to
> place everything under site-packages --> "Python27\Lib\site-packages
> \PackageName\blah". Of course client created files should be saved to
> a more accessible place.

Oh. Just looking at my setup (Ubunutu 11.10) and I see that /usr/lib/python2.7 doesn't have a site-packages directory. However, /usr/local/lib/python2.7 has both dist-packages and site-packages. 

So, my stuff should probably go into /usr/local/lib/python2.7/site-packages?

Interesting (?) that these are empty dirs right now?

Also, if I look at my sys.path value I see that /usr/local/lib/python2.7/dist-packages is in the path; but site-packages is not.

> Considering mymodules is a valid python package, you can do:
> py> from mymodules import foobar

Yes. Understand that part. And then I can just call 'foobar()'. What I was wondering is if there was a way to set something in __init__.py to shorten the calls. So, if I have:


Is there some magic I can put into myprogram/__init__.py which forces modules to be imported from mymods instead of myprogram/mymods?


More information about the Python-list mailing list