[IPython-user] the edit magic saga continues...
Fernando.Perez at colorado.edu
Tue May 17 12:38:55 CDT 2005
danny shevitz wrote:
> So after stepping through the code, magic edit was working. Then it
> stopped working again. I have debugged some more and have further
> trapped the problem. What seems to be the problem is that in
> hooks.editor the
> os.system call (line 72) is not waiting for the editor to close the
> process before returning. In other words os.system(editor)is returning
> immediately, before the editor is closed, so I always get empty text
> returned. Any changes to the temp file are never recorded.
> Any ideas how to proceed from here...
Good job. Have a look at the docstring for hooks.py, which indicates how to
define your own editor hook. You'll have to write a function with the same
signature, whic waits correctly under win32. You can then set this as your
own hook in your config file.
The default hook is a very basic one, whcih works OK under *nix and perhaps
for notepad under win32, but it has very little smarts. That's why the hooks
mechanism was put in place: so users could define arbitrarily fine-tuned
editor handling functions.
I hope this helps,
More information about the IPython-user