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


Groups > comp.lang.python > #11331 > unrolled thread

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

Started byKevin Walzer <kw@codebykevin.com>
First post2011-08-12 22:49 -0400
Last post2011-08-14 13:15 -0400
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

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

FromKevin Walzer <kw@codebykevin.com>
Date2011-08-12 22:49 -0400
Subjectos.system() on Windows in Tkinter app spawns console window
Message-ID<e1a7c$4e45e60e$4275d90a$2599@FUSE.NET>
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
-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

[toc] | [next] | [standalone]


#11334

FromNobody <nobody@nowhere.com>
Date2011-08-13 06:15 +0100
Message-ID<pan.2011.08.13.05.15.25.70000@nowhere.com>
In reply to#11331
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().

[toc] | [prev] | [next] | [standalone]


#11402

FromKevin Walzer <kw@codebykevin.com>
Date2011-08-14 13:15 -0400
Message-ID<414ef$4e48029f$4275d90a$19723@FUSE.NET>
In reply to#11334
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web