popen under nt?

Miki Tebeka mtebeka at intel.com
Tue Aug 1 09:26:16 EDT 2000


Hello Thomas,


> I'm looking for a functinality like popen but under nt. It meands
> starting a new programm in a new "process" and read stdout and stderr.
>From the FAQ
http://www.pythonlabs.com/pub/www.python.org/doc/FAQ.html#7.13

--------------
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. 

Example: 

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


Bye.
------------------------------------------------------------------------------
Smile, damn it, smile.

(lambda (msg)
  (case msg
	((name)		"Miki Tebeka")
	((email)	"tebeka at lycosmail.com")
	((homepage)	"http://www.tebeka.freeservers.com")
	((quote)	"I don't suffer from insanity, I enjoy every minute of it.")))




More information about the Python-list mailing list