Hiding console with program compiled in PY2EXE
Pieter Claerhout
Pieter.Claerhout at Creo.com
Fri Dec 19 03:17:48 EST 2003
Specify the -windows option in the py2exe command line. Example:
python setup.py py2exe --windows
By default, if the script ends with .pyw, it will create a console-less GUI
app. If it ends with .py, it will create a console application. By using the
--console or --windows flags, you can control this behaviour.
What I normally do to freeze a program this way is the following:
1. I create an executable using the --console option.
2. Run it on a computer that doesn't have Python installed to make sure
every required part is present. If not, adjust and go back to step 1.
3. After the program is working fine, I run py2exe using the --windows
option to create the console-less GUI app.
4. Test it again.
It might be handy to wrap the main function of your application in a
try/except statement and redirect the traceback to a file so that you know
what went wrong if you run the application without the console window.
Cheers,
pieter
-----Original Message-----
From: mnations at airmail.net [mailto:mnations at airmail.net]
Sent: 19 December 2003 07:34
To: python-list at python.org
Subject: Hiding console with program compiled in PY2EXE
Hi all,
I know that to hide a console normally you simply change the extension
from .py to .pyw. That's simple enough. However I can't seem to
accomplish the same thing after freezing the program. I've tried
building the setup file with the python script as a .pyw file, but it
crashes and doesn't give me a reason. This is of course because the
debug window doesn't open, so you don't know what happened (ahh, the
irony).
Does anyone know how to successfully freeze a program with py2exe?
Many thanks,
Marc
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list