py2exe question

Gordon McMillan gmcm at hypernet.com
Sun Dec 9 11:20:46 EST 2001


Syver Enstad wrote:

> My question on py2exe is: Is it possible to make an exe that searches
> the normal sys.path for modules that doesn't exist in the exefile
> itself?
> 
> When I create a barebones py2exe exe by --excluding all modules I get
> import error because py2exe overrides the import mechanism in python
> to only search in the py2exe file itself, at least that's how I have
> understood it. Does anybody have any tips for accomlishing this?

First of all, the whole point of py2exe / Installer is to be able to run
a "frozen" app from one Python version on a system that may have another 
Python version installed. If a Python 1.5 app tried to use the lib from
a Python 2.1 installation, it would probably die.

Second, Python figures out sys.path by starting a search based on the 
location of the exe. That's not going to work either.

Not positive about py2exe, but I would guess that if you filled in 
sys.path with appropriate values yourself, it would search it (at least
Installer will). But given the above 2 problems, I doubt you'll find
a satisfactory solution.

-- Gordon
http://www.mcmillan-inc.com/



More information about the Python-list mailing list