Newbie question regarding py2exe.

Raymond Arthur St. Marie II of III rastm2 at aol.commorespam
Thu Jul 24 04:20:16 EDT 2003


Marco - talking about py2exe said

>
>Sometimes modulefinder.py complains, other times its VersionInfo.py. 
>
>My question is how robust is py2exe? (Note that I have followed the docs to
>the letter.)
>
>Cheers, Marco
>

I sympathize Marco. 
Last night I tryed py2exe for the very first time.

I wrote a trivial random LOTTO Picker with GUI, as a test.
Used anygui - trying it for the first time also. 
Just a few labels, a Button to gen the nums and a one line text box for
display.
Impressed with anygui, I moved on to py2exe.

It worked ,,,,,,,eventualy. 

What I found was that...

There are no where near enough docs for py2exe.

    Yeah there's plenty of info for distutils and setup scripts
     but the "lazy" hacker is looking for samples.
   
    A repository for donated, well doc'ed "setup.py" examples is 
    IMHO needed. Write a working setup - doc it good - mail it to the archive.
    Donated because I can't expect Thomas Heller to 
    imaginate\dream up every possible way to write one.

I used the setup file for Aliens by ShredWheat at REMOVEMEmediaone.net
that I found at PYGAME as an example.
I hacked it and made it my slave and it did what I expected very well.

It's amazingly robust - to answer your question above. 

I looked forward to the py2exe output to list my unfound dependencies.

    It did this very well.
          (aside = Please someone tell me 
          how to capture the output to file in win32 comand line?
          I didn't see an option for that in the Doc at the website.)
    
    Writing the anygui script in Pythonwin made my backend( ) == mswgui. 
                                                                          
(sounds nasty don't it)
    This ment that all the anygui imports became the entire list of unresolved
modules.
    
    I could only imagine that if I had gone ahead and resolved them all in the
setup 
    script I would still be resolving them now. ( Am I correct in assuming this
would take
    me all the way down to Win32 sys dll's ? Anybody?)

Fortunately, I remembered reading that if the originating script only included 
pure Python code, then the modulefinder should have no problems.

Anygui to the rescue. Switched the backend to TKgui at the import statment.
One little change and YIPPIE ! All done. 
That ment that the setup.py became as simple as ...

# setup.py
from distutils.core import setup
import py2exe

setup(name="myscript",
      scripts=["myscript.py"],
)


Made my little 1.76Kb script into a whoppin 2MEGABYTES --- and that's the zip
file.

I got the entire TCL\TK source in there. 189 files including my script and the
Python dll
at 5,096kb ,,,,,,,,,, 5.1 MEG and it only took about as much wait time to build
as the zip 
file did to zip it.

Does it all have to be in there? I'm fairly certain NO.

One of these day's I'll have to add an --exclude statement or 100.
But nobody's gonna want this proggy so why.

UPSHOT -- I really like both programs and look forward to learing more about
them.

Robust? You bet !

Ray St.Marie
Rastm2 at slpamaol.com    




More information about the Python-list mailing list