popen2.Popen3 doesn't work well for me

Discussion in 'Python' started by alexrait1, Mar 9, 2005.

  1. alexrait1

    alexrait1 Guest

    I launch my python. Then I write this:
    import popen2
    popen2.Popen3("mplayer *.mpg")

    it starts playing for 2 seconds.. and then stops...
    if I quit python (ctrl - D)
    mplayer continues to run and plays music as it should...

    Any ideas?
     
    alexrait1, Mar 9, 2005
    #1
    1. Advertising

  2. alexrait1

    Steve Holden Guest

    alexrait1 wrote:
    > I launch my python. Then I write this:
    > import popen2
    > popen2.Popen3("mplayer *.mpg")
    >
    > it starts playing for 2 seconds.. and then stops...
    > if I quit python (ctrl - D)
    > mplayer continues to run and plays music as it should...
    >
    > Any ideas?
    >

    It looks like the process you start is blocking on standard input or
    output. Does

    os.system("mplayer *.mpg")

    do what you want?

    regards
    Steve
     
    Steve Holden, Mar 9, 2005
    #2
    1. Advertising

  3. alexrait1

    alexrait1 Guest

    It does but that's not what I want. I need a class which I can query
    for process termination for instance...
    Is there a way to overcome this problem with Popen3?
     
    alexrait1, Mar 9, 2005
    #3
  4. alexrait1 wrote:
    > It does but that's not what I want. I need a class which I can query
    > for process termination for instance...
    > Is there a way to overcome this problem with Popen3?


    If you're using Python 2.4 you should look into the subprocess module.
    I think these docs might be what you're looking for:

    http://docs.python.org/lib/node235.html

    STeVe
     
    Steven Bethard, Mar 9, 2005
    #4
    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. Quentin Huo
    Replies:
    3
    Views:
    475
    Patrice
    Oct 5, 2004
  2. yaya9

    xml tag doesn't work well

    yaya9, Mar 7, 2004, in forum: XML
    Replies:
    0
    Views:
    360
    yaya9
    Mar 7, 2004
  3. Guest
    Replies:
    1
    Views:
    488
    Donn Cave
    Jun 15, 2004
  4. Jeffrey Barish

    Bug in popen2.Popen3?

    Jeffrey Barish, Jun 16, 2004, in forum: Python
    Replies:
    1
    Views:
    365
    Donn Cave
    Jun 17, 2004
  5. Replies:
    1
    Views:
    444
    Fredrik Lundh
    Jun 7, 2006
Loading...

Share This Page