Py2exe: why are some standard modules NOT included?

My python program uses plugins (python files) that I import dynamically with __import__. I am linking my python program to Windows exe using py2exe.

I just spent 2 hours searching why my plugin python file could not load correctly from the .exe version. I have ImportError: "there is no module named urllib2" It turns out that my plugin used urllib2 (via an operator import urllib2) and this standard library module did not seem to be associated with exe. Other modules used in the plugin ( re, urllib, ...), do not cause problems, but perhaps they were referring to the python files that I statically include in its program.

How to find out what standard Python library packages for py2exe are used by default in exe? (so I know if I or anyone else can use them in plugins). Py2exe documentation does not give you any clue, other than saying that it includes a plurality of modules in the standard library.

+3
source share
1 answer

To find out which modules are included, look in library.zip (if there is no library.zip file - then try opening the EXE in any ZIP application) or rename it to .ZIP and try and open it.

You can see the * .pyc list. You can look at the list of files and directories to get an idea of ​​which modules are included or not.

- "packages".

, , ? , py2exe , , , ( , , , ), , , ( :)

+4

All Articles