[python-win32] py2exe question

Magnus Lyckå magnus at thinkware.se
Wed Apr 30 03:59:46 EDT 2003

At 06:35 2003-04-28 -0700, sense gin wrote:
>(3) How to compile multiple py scripts and maintain
>single copy of python22.dll and *.pyd in

If you have the option, you could make one handler script
which imports a, b, c ... and run p2exe on that to get
just a single file.

Something like this (untested):

# handler.py
import cgi, a, b, c
f = cgi.FieldStorage()
action = f['action'].value

if action in ['a', 'b', 'c']:

This means that you use the url


instead of


etc. It also means that a.py etc must be written as
modules with a main function, but that's probably a
good idea anyway...

In Unix you would also have the possibility to make
links with different names to handler.exe, and let it
work like this instead:

# handler.py
import os, a, b, c
f = os.environ()
action = f['SCRIPT_NAME'].split('/')[-1]

if action in ['a', 'b', 'c']:

Then you you wouldn't have to change the URLs, but
unfortunately, Windows shortcuts aren't anywhere near
as useful as hard or symbolic links in Unix.

Magnus Lycka (It's really Lyckå), magnus at thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program 

More information about the Python-win32 mailing list