Building Py2Exe from source

Kylotan kylotan at
Sat Dec 27 02:52:32 CET 2003

I need to be able to build Py2Exe from the source code as I am making
a Windows executable where I wish to preprocess the modules before
importing them.It looks like I can do this by adding lines to
Load_Module() in py2exe's start.c. However problem I have is that I
can't build Py2Exe using the instructions provided. Using the
designated command of "python install" I get this error:

  Traceback (most recent call last):
    File "", line 340, in ?
      raise RuntimeError, msg
  RuntimeError: PYWIN32DIR invalid.

      To build py2exe from source, you must either:

      - Download and build Mark Hammond's pywin32 source code
        from, and set
        the PYWIN32DIR variable to point to this directory

      - or change this setup script to not build run_svc target,
        then you will not be able to build Windows NT services
        with py2exe.

The main problem I encountered is that the 2nd option appears
misleading: removing run_svc from the list of targets does no good as
it still attempts to find some sort of "win32" directory before it
even gets that far. Or maybe I'm missing something.

If option 1 requires following these arduous-looking instructions:
then I'd rather bypass that if at all possible. :)  I only need to
build standard executables, not DLLs, NT services, or anything to do
with COM.

Any help getting around this problem would be much appreciated.

(Platform: Win98SE, Python 2.3.3.)

Ben Sizer

More information about the Python-list mailing list