tags:

views:

214

answers:

1

If save my code files as .pyw, no console window appears--which is what I want--but if the code includes a call to os.system, I still get a pesky console window. I assume it's caused by the call to os.system. Is there a way to execute other files from within my .pyw script without raising the console window at all? Thanks.

+4  A: 

You could try using the subprocess module if you want to avoid starting a shell (I think that is what system is for - on Windows the 'shell' is the console).

thrope
subprocess.check_call makes a good replacement for os.system in this case.
esm
That worked...Thanks!
twneale
Be sure to set `subprocess.check_call(args, shell=True)` where `args` is the command string that you would ordinarily type in a console. I'm not sure why `shell=True` is needed when I __don't__ want a console to appear, but that's what occurred in my experiment.
Kit