Hiding console with program compiled in PY2EXE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marc

    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
  • duikboot

    #2
    Re: Hiding console with program compiled in PY2EXE

    # setup.py
    from distutils.core import setup
    import py2exe

    setup(name="con vertdpi",
    scripts=["convertdpi.pyw "],
    )


    From the dos command prompt:
    c:\python23> python.exe setup.py py2exe

    This works for me.

    Hope it helps,

    Arjen
    "Marc" <mnations@airma il.net> schreef in bericht
    news:4378fa6f.0 312182234.42c4f e73@posting.goo gle.com...[color=blue]
    > 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[/color]


    Comment

    • Jørgen Cederberg

      #3
      Re: Hiding console with program compiled in PY2EXE

      duikboot wrote:[color=blue]
      > # setup.py
      > from distutils.core import setup
      > import py2exe
      >
      > setup(name="con vertdpi",
      > scripts=["convertdpi.pyw "],
      > )
      >
      >
      > From the dos command prompt:
      > c:\python23> python.exe setup.py py2exe[/color]

      Hi

      or instead

      # setup.py
      from distutils.core import setup
      import py2exe
      setup(name="con vertdpi",
      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

      [color=blue]
      >
      > This works for me.
      >
      > Hope it helps,
      >
      > Arjen
      > "Marc" <mnations@airma il.net> schreef in bericht
      > news:4378fa6f.0 312182234.42c4f e73@posting.goo gle.com...
      >[color=green]
      >>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[/color]
      >
      >
      >[/color]

      Comment

      • Anand Pillai

        #4
        Re: Hiding console with program compiled in PY2EXE

        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

        mnations@airmai l.net (Marc) wrote in message news:<4378fa6f. 0312182234.42c4 fe73@posting.go ogle.com>...[color=blue]
        > 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[/color]

        Comment

        Working...