How remove Tcl/Tk fom py2exe distribution?

Graham Fawcett fawcett at teksavvy.com
Sat Aug 16 02:04:51 EDT 2003


Michael Peuser wrote:

>Hi,
>I should like to make a distribution (using Tkinter), with standard DLLs
>removed.
>
>pythonXX.dll is no problem.
>
>tcl und tk, which make the mass of mega bytes, cannot be removed because
>_tkinter.pyd seems to expect them in the same directory
>
>(Question 1) Is there a configration or path setting in py2exe/distutils I
>have overlooked?
>
>O.k. In fact I do not want to have _tkinter.dll either because it belongs to
>standard distribution
>The command line option  --exclude Tkinter however leads to an error message
>when running the exe - this could have been expected however ;-)
>  
>

It's a bit unclear, Michael, what you're trying to accomplish. On the 
one hand, you're using py2exe to deploy your application, which suggests 
that you don't expect your users to have a Python distribution on their 
computers. On the other hand, you're looking to deploy a Tkinter app, 
but without any tcl/tk files, because they "belong to the standard 
distribution", suggesting that you *do* expect your users to have a 
Python distribution.

If you can assume that your clients have a standard distribution on 
their machines, don't use py2exe. It's the wrong tool for the job.

In case I'm missing something: you could always, as part of your build, 
just delete files from the py2exe-generated build directory. For 
example, at the end of your setup.py script, add some lines to delete 
the tk/tcl files from your build path.  I've used this "strategy" 
sometimes when building py2exe apps that use the Python Imaging Library. 
(PIL has tcl/tk import dependencies, but doesn't actually need tcl/tk 
for the majority of its functions.)

-- Graham






More information about the Python-list mailing list