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

Ross McKerchar it at crummock.com
Wed Apr 19 10:18:11 CDT 2006


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()

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



More information about the IPython-user mailing list