Hi Tim,

Yes, you're on the right track.

>>>>a,b,c = os.popen3('wt *.py','r')
>>>>res = a.read()

The error you're getting has nothing to do with the result of the 
command, but check, from the docs:

popen3( cmd[, mode[, bufsize]])

Executes cmd as a sub-process. Returns the file objects (child_stdin, 
child_stdout, child_stderr). Availability: Unix, Windows. New in version 
2.0.


 >
 > Traceback (most recent call last):
 >   File "<stdin>", line 1, in ?
 > IOError: [Errno 9] Bad file descriptor
 >
 >>>

The 'a' variable is supposed to be the process' STDIN, you are supposed 
to write to it. So if you want to read, it is the wrong file object, and 
it is in write mode, therefore the IOError.

Also check that the above docs are for os.popen(), popen2.popen() 
returns filehandles in a different order.

Hugo
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to