I've recently (not exactly sure when it broke) run into a hiccup with the %edit magic command.<br><br>I can %ed an empty file fine, but I can't %ed an object defined in that file.<br><br>[586]$ uname -a<br>Linux lothario 2.6.24-22-generic #1 SMP Mon Nov 24 19:35:06 UTC 2008 x86_64 GNU/Linux<br>
<br>I'm on ubuntu 8.04, 64 bit.<br><br>Example session:<br><br>[587]$ ipython<br>Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)<br>Type "copyright", "credits" or "license" for more information.<br>
<br>IPython 0.9.1 -- An enhanced Interactive Python.<br>? -> Introduction and overview of IPython's features.<br>%quickref -> Quick reference.<br>help -> Python's own help system.<br>object? -> Details about 'object'. ?object also works, ?? prints more.<br>
<br>In [1]: ed<br>IPython will make a temporary file named: /tmp/ipython_edit_Z2cUBh.py<br>Editing... done. Executing edited code...<br>Out[1]: 'class foo(object):\n pass\n'<br><br>In [2]: foo()<br>Out[2]: <__main__.foo object at 0x7ffecb766d90><br>
<br>In [3]: foo<br>Out[3]: <class '__main__.foo'><br><br>In [4]: ed foo<br>WARNING: The file `None` where `<class '__main__.foo'>` was defined cannot be read.<br><br>In [5]: ls /tmp/ipython_edit_Z2cUBh.py<br>
/tmp/ipython_edit_Z2cUBh.py<br><br>In [6]: ls -l /tmp/ipython_edit_Z2cUBh.py<br>-rw-r--r-- 1 ksmith ksmith 28 2009-01-06 23:11 /tmp/ipython_edit_Z2cUBh.py<br><br>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.<br>
<br>Checking the mailing lists didn't yield many results.<br><br>Thanks for your help,<br><br>Kurt<br>