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. Advertisements

  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
     
    duikboot, Dec 19, 2003
    #2
    1. Advertisements

  3. 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
     
    =?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
     
    Anand Pillai, Dec 19, 2003
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.