py2exe problem

Thomas Heller thomas.heller at ion-tof.com
Mon Jul 23 12:09:37 EDT 2001


"Jay Parlar" <jparlar at home.com> wrote in message news:mailman.995667696.25448.python-list at python.org...
> My colleague and I are working on an application, coded mostly in Python, that must be distributed to people who don't
> have Python installed on their machines. Anyway, py2exe seemed the natural way to do this. However, it doesn't seem to
> be working correctly (although as is usually the case, I believe it has more to do with me than with py2exe).
>
> The first step in using py2exe is giving it an install script. Because of the nature of the program, we have all the components
> broken down into about 10 or 11 files, with one main file that coordinates everything. Using the suggestion from the py2exe
> page, my install script is simply the following:
>
> #install.py
> from distutils.core import setup
> import py2exe
> setup(name="webpass", scripts=["window1.py"], )
>
> Now, this is my first time using Distutils, so maybe my install script isn't done correctly. It seems to compile all the modules
we
> created ourselves when I run py2exe (I see their filenames going by on the screen during compilation).
>
> Because the app is for Windows, I compile the exe with the following command line:
>
> python install.py py2exe -w
>
> When run, the final product is supposed to present a GUI written in wxPython, which accesses an Access database using
> ADODB. When we run the file without py2exe, everything works (well, mostly works, we have some small bugs here and
> there, but we at least have an alpha version running). However, when I run the py2exe created .exe file, I have problems.
>
> If I run the .exe on my development machine, where Python is present, the GUI comes onto the screen properly, but the
> ADODB doesn't work perfectly. For some reason, it doesn't access one field of the database. However, if I run the .exe on
> a machine without Python, the GUI doesn't come up at all. I can tell that the backround operations are doing something,
> because the .ldb file for the database is generated after I try running the .exe, but the GUI never comes on screen.

wxPython has its own (binary) dependencies which must be fulfilled.
Maybe the gui cannot start up because these dependencies are not fulfilled.
You can download at http://www.dependencywalker.com/ a free tool that
allows to search for dependent modules, you can and should especially
use it at the typical target systems where your app is supposed
to run. wxPython for example (at least in a certain version)
requires some opengl libraries, even if you do not use them
in your app.

>
> In addition, there is a command line option which would do nothing but print one line to a standard DOS prompt, but it won't
> even print that line. Again, the backround operations work (this command line creates registry entries, and they are present
> afterwards), but there is no screen output.

Maybe there's a confusion: The -w command line flag to py2exe does NOT
specify a windows executable, it specifies an application
which runs in the windows _GUI_ subsystem - as opposed to the -c flag,
which creates a _console_ application.
For a wxPython app you would probably use the -w option, but if you
also print something to the console you need -c!

(I should probably rename this command line option to --gui.)

As Duncan Booth already suggested in his reply, it is generally
a good idea to start by building a commnd line version even if
you eventually will only be using a gui - you may not see
tracebacks or error messages otherwise.

Thomas





More information about the Python-list mailing list