os.popen() and dir command

Peter Hansen peter at engcorp.com
Tue Feb 4 10:17:59 EST 2003


nobody wrote:
> 
> The following code does not run properly on Windows XP
> (it is supposed to get all zip file names):
> 
> f =os.popen("dir /b /s w:\\*.zip")
> p=f.readlines()
> 
> The p will end up with a lot of nulls in it, it looks that os.popen() is
> still broken.
> Does anybody else have problem with os.popen() and dir command?

Works fine on my machine (substituting c:\\temp\\ for w:\\).  No 
nulls in p.  I'm on Win98.

What version are you running?

(But note Gilles' response, with which I completely agree.  I'd
only look into this if it suggested a bug with os.popen and not
something unique to your machine.)

-Peter




More information about the Python-list mailing list