Hide DOS console for .pyc file

M

Muddy Coder

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
 
L

Lawrence D'Oliveiro

In message
Muddy said:
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!

Don’t run it on Windows.
 
D

Dave Angel

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
 
P

Peter Otten

Lawrence said:
In message


Don’t run it on Windows.

If you switch the OS for every minor problem you'll run out of operating
systems pretty soon...
 
T

Terry Reedy

Have them run with pythonw.exe instead of python.exe. That is how IDLE
does it.
 
J

Jonathan Hartley

Not if you choose a suitably flexible and portable one to begin with.



It isn't the OP choosing, it's his client. Now, I dislike aspects of
Windows as much as anybody, but even I can see that dictating which OS
your client is allowed to use if they want to run your program is
sometimes not a viable option.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top