This is an old copy of the Python FAQ. The information here may be outdated.

Why doesn't os.popen() work in PythonWin on NT?

The reason that os.popen doesn’t work from within PythonWin is due to a bug in Microsoft’s C Runtime Library (CRT). The CRT assumes you have a Win32 console attached to the process.

You should use the win32pipe module’s popen instead which doesn’t depend on having an attached Win32 console.


import win32pipe
f = win32pipe.popen('dir /c c:\\')
print f.readlines()

CATEGORY: windows


A Django site. rendered by a django application. hosted by webfaction.