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

Discussion in 'Python' started by Kevin Walzer, Aug 13, 2011.

  1. Kevin Walzer

    Kevin Walzer Guest

    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
     
    Kevin Walzer, Aug 13, 2011
    #1
    1. Advertising

  2. Kevin Walzer

    Nobody Guest

    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().
     
    Nobody, Aug 13, 2011
    #2
    1. Advertising

  3. Kevin Walzer

    Kevin Walzer Guest

    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
     
    Kevin Walzer, Aug 14, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miktor
    Replies:
    7
    Views:
    12,065
    Joe Bacigalupa
    Aug 9, 2005
  2. Replies:
    3
    Views:
    388
  3. Kris Rudin

    console app w/o seeing console?

    Kris Rudin, Nov 11, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    133
    Randy Charles Morin
    Nov 11, 2003
  4. Nathan Craddock

    Web Reference class spawns temporary assembly when instantiated?

    Nathan Craddock, Oct 7, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    135
    Nathan C.
    Oct 13, 2005
  5. Replies:
    14
    Views:
    265
Loading...

Share This Page