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
2009-11-19 17:31:08
subprocess.check_call makes a good replacement for os.system in this case.
esm
2009-11-19 18:05:54
That worked...Thanks!
twneale
2009-11-19 22:10:04
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
2010-07-19 02:32:09