output of shell command

Steve Holden sholden at holdenweb.com
Tue Feb 27 23:52:34 CET 2001


"Mark Hadfield" <m.hadfield at niwa.cri.nz> wrote in message
news:983312067.173004 at clam-ext...
> "Ben Hutchings" <ben.hutchings at roundpoint.com> wrote in message
> news:u3dczkcpk.fsf at roundpoint.com...>
>
>  > os.popen("dir").readlines() works for me in PythonWin 2.0 #8 on
> > Windows 2000 SP1, but I would not be surprised to find that it fails
> > to work on Windows 98, though - there are large differences between
> > the command interpreters and pipe implementations in different
> > versions of Windows.  For that matter, the output format of dir may
> > differ too.
>
But this still doesn't explain the difference between the vanilla
interpreter result and PythonWin's attempt.

> As I reported in my message yesterday, when I tried
> os.popen("dir").readlines() in PythonWin (win32all-137) on Windows 200 it
> failed. Today I tried it again & it worked. Why would that be? I'm picking
> operator error.
>
Dunno. Still won't work for me on Windows 98. Neither, come to that, does
the parenthesized version

    a=(os.popen("dir")).readlines()

I get the same error.

> So why did it fail under PythonWin on Steve Holden's machine? Win98 vs
> Win2000? Operator error again? What do you think, Steve?
>
I think I'm going to stop trying to do it under PythonWin. There are *real*
problems I have to work on :-)

regards
 Steve






More information about the Python-list mailing list