Hi Tim,

> I now realize that to properly test this, I should use a command that
> returns legitimate data:
> I think the following gets me started:
> f = os.popen('ls *.py','r').read()
> now I have captured the output from 'ls *.py'.

You probably should consider using the Popen class in the new 
subprocess module. It makes all previous mechanisms (system, 
popen, commands, fork, execv etc) obsolescent.

There are basic instructions for using Popen to replace popen[n]  
etc in my new OS topic on the web site and the documentation 
gives some rather terse examples too...

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



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

Reply via email to