Some Results from Trying to Cheat py2exe

Michael Peuser mpeuser at web.de
Sat Aug 16 18:32:12 EDT 2003


Hi,
I tried to reduce the size of some binary distribution in removing the
things I could expect on the presumed targets - generally a minimal
installation including Tcl/Tk.

The results are as follows:

(1) It does not seem possible to remove any *.pyd files: py2exe or whoever
wants them in the local directory. sys.path seems not to be used. Even
deleting it altogether has no impact at all.

(2) sys.path, sys.exec_prefix  and sys.prefix are set to the local
directory, changes to them also have no visible effect.

(3) Removing DLLs has been more successful. However it is a matter of PATH
setting on the target, where they are found. This seems to be irrelevant for
the interpreter, alas not for tcl and tk.

(4) It seems that Tcl and Tk expect some support data in folders tcl8.3 and
tk8.3 which are expected at ../lib (i.e. one back and in a folder called
lib). This is generally NOT the situation in a standard Python installation
(where they are in ..\tcl) nor is it the case in the local directory of
py2exe (where they are in ./tcl). This is something I do not understand!

(5) Thus if the DLLs are found in a standard Python installation, it will
fail. It is generally not possible to make a safe setup because of
uncontrollable PATH settings.....

(6) Those Tcl/Tk folders are quite large, mostly because of some asiatic
unicode files. Those can safely be deleted I think.

Conclusion: For distributions to customers without Python and unwilling to
do any system changes it would be safest to fill some PYAPP folder with
tcl/tk, the tcl folder and interpreter and maybe wxms24h  DLLs. Than just
drop your installations into that folder. This can safely be done when
un-zipping them. The drawback is that there is no strcture at all inside
that folder.

The second best solution would be to put that PYAPP folder anywhere (however
the structure must be changed, because of (4): PYAPP has to contain a DLL
directory and the LIB  directory  for the tcl/tk folders. the PATH setting
must be done to PYAPP/LIB. Now a reduced distribution can be put anywhere.
This has some advantages from the point of configuration control, however is
bound to break if the user decides to install a full Python.

The situation is a mess and it took me some time to sort out all the
problems (help came from Thomas Heller). So may be it will help someone -
and be it  to keep hands off ;-)


Kindly
Michael P






More information about the Python-list mailing list