Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Hiding console with program compiled in PY2EXE

Reply
Thread Tools

Hiding console with program compiled in PY2EXE

 
 
Marc
Guest
Posts: n/a
 
      12-19-2003
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
 
Reply With Quote
 
 
 
 
duikboot
Guest
Posts: n/a
 
      12-19-2003
# setup.py
from distutils.core import setup
import py2exe

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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?J=F8rgen_Cederberg?=
Guest
Posts: n/a
 
      12-19-2003
duikboot wrote:
> # setup.py
> from distutils.core import setup
> import py2exe
>
> setup(name="convertdpi",
> scripts=["convertdpi.pyw"],
> )
>
>
> From the dos command prompt:
> c:\python23> python.exe setup.py py2exe


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


>
> This works for me.
>
> Hope it helps,
>
> Arjen
> "Marc" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed) om...
>
>>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

>
>
>


 
Reply With Quote
 
Anand Pillai
Guest
Posts: n/a
 
      12-19-2003
The way to prevent a py2exe program from throwing up
a console is to pass the '--windows' option to it.

i.e change your py2exe command line from

%python setup.py py2exe

to

%python setup.py py2exe --windows

HTH.



-Anand

http://www.velocityreviews.com/forums/(E-Mail Removed) (Marc) wrote in message news:<(E-Mail Removed). com>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
py2exe "for loop" hangs in compiled program p_tierchen Python 1 01-11-2010 04:53 AM
runningpkg_resources from a compiled py2exe program David Lyon Python 0 04-15-2009 06:48 AM
runningpkg_resources from a compiled py2exe program David Lyon Python 0 04-15-2009 06:38 AM
g++ compiled C++ code called from gcc compiled C code Klaus Schneider C++ 1 12-02-2004 01:44 PM
RE: Hiding console with program compiled in PY2EXE Pieter Claerhout Python 2 12-20-2003 01:34 AM



Advertisments