os.system() on Windows in Tkinter app spawns console window

K

Kevin Walzer

I'm developing a Tkinter app for a Windows customer, and the app bundles
several command-line tools (ported from Unix). I call out to these
console tools from the Tkinter app via os.system(). However, in the
frozen version of my app, when I call out to these tools, I get multiple
console windows popping up. This is jarring to say the least. Is there
any way to run the commands under the hood without the console/DOS
windows popping up?

--Kevin
 
N

Nobody

I'm developing a Tkinter app for a Windows customer, and the app bundles
several command-line tools (ported from Unix). I call out to these
console tools from the Tkinter app via os.system(). However, in the
frozen version of my app, when I call out to these tools, I get multiple
console windows popping up. This is jarring to say the least. Is there
any way to run the commands under the hood without the console/DOS
windows popping up?

Just a wild guess, but try explicitly redirecting the commands'
stdin/stdout/stderr. You might also consider using subprocess.call()
instead of os.system().
 
K

Kevin Walzer

Just a wild guess, but try explicitly redirecting the commands'
stdin/stdout/stderr. You might also consider using subprocess.call()
instead of os.system().

I've gotten the CLI commands to execute silently by setting the window
flags for subprocess as discussed here:

http://code.activestate.com/recipes/409002-launching-a-subprocess-without-a-console-window/

These flags are apparently undocumented, but this solution works
perfectly. Perhaps the flags should be better documented.

--Kevin
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top