py2exe question

Jimmy Retzlaff jimmy at retzlaff.com
Sat Nov 1 12:35:01 EST 2003


Alex Martelli wrote:
> achrist at easystreet.com wrote:
> > Alex Martelli wrote:
> >> achrist at easystreet.com wrote:
> >>
> >> > The py2exe says that a console app should have the --console
option
> >> > and a windows app should have the --windows option.
> >> >
> >> > What is the way to py2exe a python program that uses both console
and
> >> > windows gui?
> >> > Haven't tried, but logically it should be a console -- this
doesn't
> >> > restrict
> >> what OTHER modules you can import, it just uses the equivalent of a
.py
> >> script run with python.exe rather than a .pyw run with pythonw.exe,
> i.e.
> >> a "DOS box" console does appear when the program is run.
> >
> > Logically, you don't need these switches.  Outside of py2exe a *.py
> > gets a console and can open gui windows, a *.pyw is a pure gui
> > program.  Why the switches atall?  IDK?  Thought I'd ask.
> 
> The switches let you control what goes on explicitly, just as
> you can control it explicitly by choosing one or the other of
> the two interpreters (python.exe or pythonw.exe) at a command
> prompt.  I don't know what you mean by the 'idk' question.

I think Al's point may be that if you run py2exe on a .pyw script it
should automatically use the pythonw.exe stub and if you run it on a .py
script it should use the python.exe stub. I wouldn't care for that
behavior unless I could override it with the switches. I always use a
.py extension when developing my GUI apps so I can see console output
which is very handy for debugging output and seeing any unhandled
exceptions. When I deploy my GUI app, I don't want the user bothered by
a console so I explicitly ask for a windows only app.

> > I'm having a little trouble getting a py2exe executable to run on
> > a machine wo python installed.  Just wondered if this has anything
to
> > do with it.
> 
> I don't see the connection.

As mentioned earlier (was it another thread?), temporarily letting
py2exe display a console can aid in debugging py2exe specific problems
by letting you see unhandled exceptions and other output. Once things
are working then turn the console off again. I do have vague memories of
hearing about people having problems with some buffers filling up if
there is no console and there is a significant amount of console output.
Temporarily turning on the console would let you know if you have tons
of console output that might expose such a problem. I don't, however,
see how this kind of thing would differ between machines with and
without Python installed.

Jimmy






More information about the Python-list mailing list