Hide DOS console for .pyc file

Dave Angel davea at ieee.org
Sat Sep 11 11:37:06 CEST 2010


  On 2:59 PM, Muddy Coder wrote:
> Hi Folks,
>
> For a quick testing purpose, I deliver .pyc files to my customer. I
> don't want the black DOS console appearing behind my GUI, but I have
> no idea how to do it. Somebody can help? Thanks!
>
>
> Cosmo
>
In Windows, the executable file statically determines whether a console 
is created.  There are two executables shipped with Python,  python.exe 
and pythonw.exe.  You want to use the latter.

The real question is how to cause Windows to run that rather than 
python.exe.  Answer depends on how your use is launching his program.

If he's starting from a shortcut, change the name of the executable on 
the shortcut.  If he's starting by double-clicking on the script name, 
change the extension of the script from .py to .pyw

You mention that you're shipping only .pyc files.  If that's the case, 
add one more, a .pyw that imports your main script.  Of course, that may 
mean changing that script a little so it works as a module.

DaveA




More information about the Python-list mailing list