[Python-Dev] Existence of pythonNN.zip in sys.path

Anthony Tuininga anthony.tuininga at gmail.com
Mon May 5 23:32:46 CEST 2014


Hi,

I am the author of cx_Freeze which creates "frozen" executables from Python
scripts. To this point I have been using frozen modules (compiled C) but
this has the side effect of bundling parts of Python with a cx_Freeze
release -- and this has bitten me on a number of occasions when newer
versions of Python use slightly incompatible modules. :-)

By scanning the code I discovered that Python automatically searches on
startup

<PYTHONHOME>/lib/pythonNN.zip

where NN is replaced by the major and minor version that is being executed.
Using this would allow me to ensure that bootstrap modules are not bundled
with cx_Freeze but acquired from the distribution that is actually using it
-- thereby eliminating the hassle noted above.

I have tested this approach and found it works flawlessly. There is,
however, no documentation that I can find for the contents of sys.path --
the documentation simply says that it is an installation default and
doesn't specify what that default is.

So my question is: can I safely make use of this "feature"? It has remained
in place since at least Python 2.6 but I don't want to assume anything.
Please advise! Thanks.

Anthony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140505/d4363e54/attachment.html>


More information about the Python-Dev mailing list