py2exe - convert python scripts into exe files (windows)

Alex Martelli aleaxit at yahoo.com
Fri Jan 19 12:13:31 EST 2001


"Thomas Heller" <thomas.heller at ion-tof.com> wrote in message
news:mailman.979914438.23900.python-list at python.org...
> I've created a distutils extension to convert python scripts
> into standalone windows executable files.
> You end up with an exe-file as well as pythonxx.dll
> plus some .pyd's.
>
> This is more or less a rewrite of Gordon's installer project.
>
> Homepage: http://starship.python.net/crew/theller/py2exe/

Very interesting idea, but I must be doing something wrong.

I downloaded and installed this under my Python 2.0 on NT,
then to try it out wrote a hello.py:

print 'hello world'

and a setup.py:

from distutils.core import setup
import py2exe
setup(name="hello",
   scripts=["hello.py"],
)

and ran python setup.py py2exe.  So far so good -- it
built a dist\hello subdirectory containing:

D:\PySym\salo\dist\hello>dir
 Volume in drive D has no label.
 Volume Serial Number is 0498-B4C2

 Directory of D:\PySym\salo\dist\hello

01/19/01  06:07p        <DIR>          .
01/19/01  06:07p        <DIR>          ..
01/19/01  06:07p                20,326 hello.exe
10/16/00  04:28p               667,709 python20.dll
               4 File(s)        688,035 bytes
                            117,059,584 bytes free

However, when I try to run this EXE, it doesn't work
_quite_ right...:

D:\PySym\salo\dist\hello>.\hello
KeyError: imputil.pyc
Traceback (most recent call last):
  File "<string>", line 22, in ?
NameError: There is no variable named 'imputil'
hello world

D:\PySym\salo\dist\hello>


Assuming the error message (before the actual output)
is not 'working as designed' -- where am I going
wrong...?  Thanks!


Alex






More information about the Python-list mailing list