Hiding console with program compiled in PY2EXE

Discussion in 'Python' started by Marc, Dec 19, 2003.

  1. Marc

    Marc Guest

    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
     
    Marc, Dec 19, 2003
    #1
    1. Advertising

  2. Marc

    duikboot Guest

    # 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" <> schreef in bericht
    news:...
    > 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
     
    duikboot, Dec 19, 2003
    #2
    1. Advertising

  3. 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" <> schreef in bericht
    > news:...
    >
    >>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

    >
    >
    >
     
    =?ISO-8859-1?Q?J=F8rgen_Cederberg?=, Dec 19, 2003
    #3
  4. Marc

    Anand Pillai Guest

    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

    (Marc) wrote in message news:<>...
    > 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
     
    Anand Pillai, Dec 19, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pieter Claerhout
    Replies:
    2
    Views:
    565
  2. Miktor
    Replies:
    7
    Views:
    12,074
    Joe Bacigalupa
    Aug 9, 2005
  3. David Lyon
    Replies:
    0
    Views:
    243
    David Lyon
    Apr 15, 2009
  4. David Lyon
    Replies:
    0
    Views:
    203
    David Lyon
    Apr 15, 2009
  5. p_tierchen
    Replies:
    1
    Views:
    304
Loading...

Share This Page