We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

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