[Tutor] os.popen() questions

Magnus Lyckå magnus at thinkware.se
Sat Jul 24 12:42:11 CEST 2004

At 19:19 2004-07-23 -0400, Brian van den Broek wrote:
>import os
>the_program = r'C:\clamav-devel\bin\clamscan.exe'
>a = os.popen('dir *.*').readlines()             # works fine
>os.system('start %s > testing.txt' %the_program)
>b = os.popen(the_program).readlines()
>print b                                         # prints as []
>print a

Are you sure that clamscan.exe writes to stdout? Maybe it
actually writes to stderr? I don't think popen.readlines
will catch that (but DOS ">" will).

You might want to use popen3 or popen4 instead.

Magnus Lycka (It's really Lyckå), magnus at thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language 

More information about the Tutor mailing list