Import, how to change sys.path on Windows, and module naming?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Mar 3 19:14:33 EST 2008
En Mon, 03 Mar 2008 14:39:20 -0200, <bockman at virgilio.it> escribió:
> On 3 Mar, 17:12, bock... at virgilio.it wrote:
>
> Oops... I tried removing python25.zip from sys.path, and I can still
> import packages from zip files ...
Yes, python25.zip is in sys.path by default, not to enable zipimport
(which is enabled by default, if zlib is available), but to allow the
entire Python library to be distributed in a .zip
When Python starts, it imports site.py (and a *lot* of other modules, too
much for my taste); that script is responsible of building sys.path,
adding lib/site-packages and looking for .pth files and so. Before that,
sys.path contains a minimal set of dirs. If there were no .zip already in
sys.path, site.py (and all the modules it uses) should exist on an actual
directory already present on sys.path in order to be imported - so the
entire library could not reside on a zip file.
Having python25.zip in sys.path by default (*before* processing site.py)
allows to distribute the whole std library (and possibly other packages
too) in a single zip file.
--
Gabriel Genellina
More information about the Python-list
mailing list