[IPython-user] iPython & os.popen under windows [cont]

Ross McKerchar it at crummock.com
Wed Apr 19 10:38:52 CDT 2006


Many apologies, I sent that before I had finished putting in the details.

Further to my original post here is some additional info:

I am using Python 2.4 (the ActivePython distribution).
my iPython version is the most recent 0.7.1.fix1 version.

I also found some problems with os.popen in older versions of 
windows/python so tried using win32pipe.popen. This didn't solve my 
problem, unfortunately.

My original post is attached below, for convenience.

Sorry!

-ross
**
-------- Original Message --------
Subject: 	iPython & os.popen under windows
Date: 	Wed, 19 Apr 2006 16:18:11 +0100
From: 	Ross McKerchar <it at crummock.com>
To: 	ipython-user at scipy.net



Hello,

I cant get the os.popen function to work in iPython.

More specifically, the file like object it returns doesn't seem to 
contain anything.

Here's a concrete example:

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

Works fine when run straight from the python interpretor, printing a 
list containing the output of the dir command, one line per item.

However, in iPython f.readlines() instead returns an empty list.

The only similar problem I have found is from someone using cygwin (post 
here: 
http://mail.python.org/pipermail/python-list/2004-March/210882.html) but 
it doesn't look relevant, as far as I can see.

thanks in advance for any suggestions.

regards,

-ross





More information about the IPython-user mailing list