[IPython-user] ipython SVN less friendly about EDITOR

Zachary Pincus zpincus at stanford.edu
Thu Mar 16 01:11:28 CST 2006

Hello again,

I just upgraded from ipython 0.7.1fix1 to the svn version of ipython.  
Now, the 'edit' magic command doesn't work for me anymore.  
Specifically, my 'EDITOR' variable was set in the ipythonrc file to be
mate -w
where 'mate' is a little command line program that opens my GUI  
editor of choice, TextMate, and -w instructs 'mate' to wait until  
TextMate closes the file to exit. This is just right for ipython...

Except that ipython in svn doesn't seem to accept editor values with  
arguments anymore. Viz:
> IPython will make a temporary file named: /tmp/ipython_edit_SQbihW.py
> Editing...sh: line 1: mate -w: command not found
> done. Executing edited code...
> Could not open file </tmp/ipython_edit_SQbihW.py> for safe execution.
> WARNING: File not found. Did you forget to save?

It seems that in hooks.py, the editor is called via
os.system('"%s" %s %s' % (editor,linemark,filename))
so the 'editor' value is quoted explicitly. This is good if the user  
has provided an editor with spaces in the path in the rc file; it's  
less good if the user has provided an editor with arguments in the rc  

There are a couple solutions here:
(1) Go back to the old way and tell people who want EDITOR values  
with spaces in the paths (or whatever) to explicitly quote the EDITOR  
(2) Provide an EDITOR_ARGUMENTS rc option.
(3) Tell me to sod off and just write a wrapper that calls 'mate -w'  
and set that wrapper to EDITOR.

I'm fine with any of these options. I just wanted to point out a  
potential annoyance from moving from 0.7.1 to the SVN head, so you  
all could decide what (if anything) to do about it.


More information about the IPython-user mailing list