I really like Python but ....

Alex Martelli aleaxit at yahoo.com
Sun May 27 17:30:23 EDT 2001


"Bill Walker" <bwalker at earth1.net> wrote in message
news:th2iks4tvcmh99 at corp.supernews.com...
> I've tried py2exe and freeze, and they both generate a directory full of
> stuff that runs fine on my main machine but fail when I take it to a
machine
> without python installed.

Funny -- I've had no problem using py2exe to move stuff to a machine
without Python installed.  You may have hit some specific bug, I guess.
Are you using the latest and greatest py2exe?  If we can pinpoint the
bug more specifically, it may be easy to fix.

Let's start simple... in directory d:\py21\pa, I put only:

:: file pao.py
from Tkinter import *

def vlorp():
    import sys
    print "Wow!"
    sys.exit()

root = Tk()
Button(root, text="just a test", command=vlorp).pack()
root.mainloop()
:: end

and

:: file setup.py
from distutils.core import setup
import py2exe

setup(name="pao",
    scripts=["pao.py"],
)
:: end

I run:

d:\py21\pa> python setup.py py2exe

and it runs for a while, with copious output, but it does
end up with what I needed:

D:\py21\pa\dist\pao>dir

 Volume in drive D is DISCO D
 Volume Serial Number is 4140-11E0
 Directory of D:\py21\pa\dist\pao

.              <DIR>        05-27-01 11:13p .
..             <DIR>        05-27-01 11:13p ..
TCL            <DIR>        05-27-01 11:13p tcl
PAO      EXE       187,010  05-27-01 11:13p pao.exe
TK83     DLL       928,768  08-08-00  1:54p tk83.dll
_SRE     PYD        49,209  04-16-01  6:26p _sre.pyd
_TKINTER PYD        28,733  04-16-01  6:26p _tkinter.pyd
TCL83    DLL       619,520  08-08-00  1:48p tcl83.dll
PYTHON21 DLL       708,669  04-16-01  6:25p python21.dll
         6 file(s)      2,521,909 bytes
         3 dir(s)     559,931,392 bytes free

D:\py21\pa\dist\pao>

I zip all of this up (including subdirectory tcl, of course --
it IS there for a purpose:-) and obtain:

D:\py21\pa\dist>dir

 Volume in drive D is DISCO D
 Volume Serial Number is 4140-11E0
 Directory of D:\py21\pa\dist

.              <DIR>        05-27-01 11:13p .
..             <DIR>        05-27-01 11:13p ..
PAO            <DIR>        05-27-01 11:13p pao
PAO      ZIP     1,949,232  05-27-01 11:16p pao.zip
         1 file(s)      1,949,232 bytes
         3 dir(s)     559,931,392 bytes free

An unzip -l pao.zip will make a long listing of the
files it contains, the end of which is:

   1583  09-14-98  11:23   pao/tcl/tk8.3/demos/entry1.tcl
   2309  09-14-98  11:23   pao/tcl/tk8.3/demos/entry2.tcl
 187010  05-27-01  23:13   pao/pao.exe
 928768  08-08-00  13:54   pao/tk83.dll
  49209  04-16-01  18:26   pao/_sre.pyd
  28733  04-16-01  18:26   pao/_tkinter.pyd
 619520  08-08-00  13:48   pao/tcl83.dll
 708669  04-16-01  18:25   pao/python21.dll
 ------                    -------
4981602                    204 files

D:\py21\pa\dist>

Now, I move to a machine that has never seen Python (but
DOES have winzip on it:-) and unpack this to its own directory
c:\pao.  I move to that directory, enter pao -- and my app
works just fine.

Not saying this can't be optimized a lot better, mind you --
for example, all of those files in 'demos' are no doubt quite
removable.  But -- it does run.  BTW, this is with py2exe
0.2.6, the latest and greatest.

Now, does this work for you with a simple application such
as this example?  If not, there must be some configuration
issues and we can determine them.  If it does work for a
simple application but fail for a richer and complex one, then
we can no doubt use bisection to find out in a few more steps
WHAT tidbit of functionality is causing you the trouble...


Alex







More information about the Python-list mailing list