popen2.Popen3 doesn't work well for me

A

alexrait1

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?
 
S

Steve Holden

alexrait1 said:
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
 
A

alexrait1

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?
 
S

Steven Bethard

alexrait1 said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top