os.popen() and dir command

nobody nobody at nowhere.near.here
Tue Feb 4 18:00:53 CET 2003


I am running Python 2.2.2. The os.popen() runs on other directories but
fails on this one. But the dir command works when run from a command promp.
The problem could be in dir command been an internal command of cmd.exe
(Windows shell interpreter).
"Peter Hansen" <peter at engcorp.com> wrote in message
news:3E3FD9A7.6FE99483 at engcorp.com...
> 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