Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #11402

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

Date 2011-08-14 13:15 -0400
From Kevin Walzer <kw@codebykevin.com>
Newsgroups comp.lang.python
Subject Re: os.system() on Windows in Tkinter app spawns console window
References <e1a7c$4e45e60e$4275d90a$2599@FUSE.NET> <pan.2011.08.13.05.15.25.70000@nowhere.com>
Message-ID <414ef$4e48029f$4275d90a$19723@FUSE.NET> (permalink)
Organization UseNetServer.com

Show all headers | View raw


On 8/13/11 1:15 AM, Nobody wrote:
> On Fri, 12 Aug 2011 22:49:32 -0400, Kevin Walzer wrote:
>
>> 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().
>

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
-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

os.system() on Windows in Tkinter app spawns console window Kevin Walzer <kw@codebykevin.com> - 2011-08-12 22:49 -0400
  Re: os.system() on Windows in Tkinter app spawns console window Nobody <nobody@nowhere.com> - 2011-08-13 06:15 +0100
    Re: os.system() on Windows in Tkinter app spawns console window Kevin Walzer <kw@codebykevin.com> - 2011-08-14 13:15 -0400

csiph-web