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
setup(name="convertdpi",
scripts=["convertdpi.pyw"],
)
From the dos command prompt:
c:\python23> python.exe setup.py py2exe
This works for me.
Hope it helps,
Arjen
"Marc" <mnat...@airmail.net> schreef in bericht
news:4378fa6f.03121...@posting.google.com...
Hi
or instead
# setup.py
from distutils.core import setup
import py2exe
setup(name="convertdpi",
scripts=["convertdpi.py"],
)
c:\python23> python.exe setup.py py2exe -w
Which works for me :)
All options are described on http://starship.python.net/crew/theller/py2exe/
Regards
Jorgen
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: mnat...@airmail.net [mailto:mnat...@airmail.net]
Sent: 19 December 2003 07:34
To: pytho...@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
i.e change your py2exe command line from
%python setup.py py2exe
to
%python setup.py py2exe --windows
HTH.
-Anand
mnat...@airmail.net (Marc) wrote in message news:<4378fa6f.03121...@posting.google.com>...
Here's my setup file:
# setup.py
from distutils.core import setup
import py2exe
setup(name="CCT",
scripts=["CCT.py"],
)
Here's the command I use to initiate the process:
python setup.py py2exe --progid "Excel.Application" --windows
It appears to compile successfully, but I get the same problem as I
did when inserted my program with the .pyw option. It starts to open,
then dies.
Does adding other options, such as COM, interfere with this process?
Does COM need the window for some reason?
Thanks,
Marc
Silly me. I had a problem further upstream that was causing it to
fail. It has nothing to do with the COM interaction. Works perfect
now!
Thanks again,
Marc