[Distutils] Re: Add multiple frozen modules

Gordon McMillan gmcm@hypernet.com
Tue, 13 Jul 1999 15:12:54 -0500


Jim Ahlstrom wrote:

> Gordon:
> > Not if you deliberately 
> > SET PYTHONPATH=.
> > which cuts the registry out entirely.
> > For my installer / standalone, I deliberately muck with the
> > environment before loading python and executing the "main" script.

> A Windows user normally sets the "Start in" directory in
> the shortcut to something other than the directory of the
> binary.  In other words, the current directory "." is unreliable.
> Users can right-click their icon and change it.

OK - os.path.dirname(sys.argv[0]).

In my case it doesn't matter. I have just concatenated my archive (of 
python15.dll, any .pyzs, exceptions.py, site.py etc.) onto the end of 
the executable. When run, it opens itself as a file and unpacks the 
archive into the current directory. Then it does a 
_putenv("PYTHONPATH=.") and dynamically loads python15.dll.  If 
you're using Run.exe, it even cleans up whatever it unpacked at end 
of run.

More advanced would be to make the archive a legit resource section 
of the exe, but I can't see that as worth the effort (esp. since I 
don't expect my users to have compilers, and I've already gone to the 
work of finding the import sections in dll headers so I can find 
binary dependencies...)

- Gordon