How do I execute a command from within python and wait on thatcommand?

Discussion in 'Python' started by black_13, Feb 15, 2008.

  1. black_13

    black_13 Guest

    how do i exec a command (such as xcopy) from with win32 python and
    wait on that command
    to come to completion? and also cleanly terminate the command shell?
    thanks
    black_13
     
    black_13, Feb 15, 2008
    #1
    1. Advertising

  2. os.system(command)

    or

    proc = popen2.Popen3(command)
    proc.wait()

    2008/2/15, black_13 <>:
    > how do i exec a command (such as xcopy) from with win32 python and
    > wait on that command
    > to come to completion? and also cleanly terminate the command shell?
    > thanks
    > black_13
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >



    --
    Rafael Sachetto Oliveira

    Sir - Simple Image Resizer
    http://rsachetto.googlepages.com
     
    Rafael Sachetto, Feb 15, 2008
    #2
    1. Advertising

  3. Rafael Sachetto wrote:
    > os.system(command)
    >
    > or
    >
    > proc = popen2.Popen3(command)
    > proc.wait()


    I don't know about "cleanly terminat[ing] the command shell", but you
    should use the subprocess module now, not any of the other functions
    scattered around.
    --
     
    Matt Nordhoff, Feb 15, 2008
    #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. Lucas Cowald
    Replies:
    4
    Views:
    1,112
    Tohid
    Oct 23, 2003
  2. Huey

    How to make "fork/wait" to WAIT longer?

    Huey, Mar 1, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,988
    -berlin.de
    Mar 1, 2004
  3. Lucas Cowald

    RUN/execute a Command-Line command from an ASP page

    Lucas Cowald, Oct 22, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    267
    Genich
    Oct 22, 2003
  4. Lucas Cowald

    RUN/execute a Command-Line command from an ASP page.

    Lucas Cowald, Oct 22, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    231
    Oliver
    Oct 22, 2003
  5. Ruwan Budha
    Replies:
    0
    Views:
    170
    Ruwan Budha
    Apr 12, 2010
Loading...

Share This Page