python spawn new process, rout stdin/out

Discussion in 'Python' started by kmkz89@gmail.com, Feb 9, 2006.

  1. Guest

    Hi,

    I'm trying to make a program that acts as an intermediate between the
    user and another executable. When my python program is executed, I
    would like another .exe to be spawned within the python program, and
    the stdin/stdout to be routed from the user to the program. So if my
    program is booted into a console window, anything typed by the user
    will be passed to the subprocess and any output from that executable
    will appear in the console, showing the user what happened. In
    addition, when the python program is closed, the subprocess should be
    closed.

    Any ideas how to do this? I am far from a Python newbie but I know
    little to nothing about os.*/subprocess.* so I need quite a bit of
    assistance.

    Thanks guys!
    kmkz
     
    , Feb 9, 2006
    #1
    1. Advertising

  2. Farshid Lashkari, Feb 10, 2006
    #2
    1. Advertising

  3. kmkz Guest

    How exactly do I map the main program's STDOUT (what the user sees) to
    the subprocess' STDOUT? In effect I want it to appear as though they
    just executed the program itself.
     
    kmkz, Feb 17, 2006
    #3
  4. kmkz Guest

    ok solved that by using the call() method

    I now have a bigger problem: the executable always wants to open in its
    own window. how do I stop this?
     
    kmkz, Feb 17, 2006
    #4
  5. Steve Holden Guest

    kmkz wrote:
    > ok solved that by using the call() method
    >
    > I now have a bigger problem: the executable always wants to open in its
    > own window. how do I stop this?
    >

    Call pythonw instead of python.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC www.holdenweb.com
    PyCon TX 2006 www.python.org/pycon/
     
    Steve Holden, Feb 18, 2006
    #5
    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. spartan
    Replies:
    1
    Views:
    1,320
    anupam
    Aug 17, 2004
  2. Derek Basch
    Replies:
    2
    Views:
    1,306
    Donn Cave
    Jan 21, 2005
  3. Ed Hames
    Replies:
    0
    Views:
    378
    Ed Hames
    Apr 16, 2008
  4. Edgardo Hames
    Replies:
    1
    Views:
    352
    Ed Hames
    May 6, 2008
  5. Terry Cooper
    Replies:
    7
    Views:
    426
    Janos Sebok
    Jun 9, 2009
Loading...

Share This Page