[Tutor] os.popen() questions

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Jul 24 13:15:17 CEST 2004


> import os
> the_program = r'C:\clamav-devel\bin\clamscan.exe'
> b = os.popen(the_program).readlines()
> print b # prints as []

> Could it be some peculiarity of the program that I am running within
the
> os.popen() call that is causing this?

It could be that all the output you normally see is actually
being sent to stderr not stdout. I think popen() only captures stdout.

There are other popen variants (popen2, popen3) that cater for stderr
too, you might need to use one of those.

HTH,

Alan G.



More information about the Tutor mailing list