[IPython-user] %edit <object> unable to read tmp file created previously with %edit

Kurt Smith kwmsmith@gmail....
Tue Jan 6 23:17:08 CST 2009

I've recently (not exactly sure when it broke) run into a hiccup with the
%edit magic command.

I can %ed an empty file fine, but I can't %ed an object defined in that

[586]$ uname -a
Linux lothario 2.6.24-22-generic #1 SMP Mon Nov 24 19:35:06 UTC 2008 x86_64

I'm on ubuntu 8.04, 64 bit.

Example session:

[587]$ ipython
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: ed
IPython will make a temporary file named: /tmp/ipython_edit_Z2cUBh.py
Editing... done. Executing edited code...
Out[1]: 'class foo(object):\n    pass\n'

In [2]: foo()
Out[2]: <__main__.foo object at 0x7ffecb766d90>

In [3]: foo
Out[3]: <class '__main__.foo'>

In [4]: ed foo
WARNING: The file `None` where `<class '__main__.foo'>` was defined cannot
be read.

In [5]: ls /tmp/ipython_edit_Z2cUBh.py

In [6]: ls -l /tmp/ipython_edit_Z2cUBh.py
-rw-r--r-- 1 ksmith ksmith 28 2009-01-06 23:11 /tmp/ipython_edit_Z2cUBh.py

For some reason it can't find the /tmp file where 'foo' was defined, even
though the file does exist and I have full read/write permissions.  Not
knowing the internals of the %edit command, I'm not sure how to proceed.

Checking the mailing lists didn't yield many results.

Thanks for your help,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20090106/49d74891/attachment.html 

More information about the IPython-user mailing list