[IPython-dev] Fwd: Multi-line history problems in ipython (mac osx)

Michael VanLandingham m.vanland at gmail.com
Wed Jan 16 18:37:36 EST 2008

On Jan 16, 2008, at 2:38 PM, Boyd Waters wrote:

> On Jan 16, 2008, at 2:12 PM, Michael VanLandingham wrote:
>> I recall that there was a bug filed in October regarding tab-
>> completion / rlcompleter (Boyd filed it).   The thing is, the multi-
>> line history problem doesn't occur in the stock python 2.5.1on
>> Leopard.  It works fine.
> I think Apple tweaked something with the update to 10.5.1
> Can you point me to the bug that I filed? I'll take another look.

<rdar://problem/5563035> Python readline - rlcompleter does not work
(on https://bugreport.apple.com/, do 'Find Problem' at the top. etc.)

>>  But it doesn't work in iPython.  I also
>> don't fully understand readline or editline, so I don't know (and
>> haven't found the time to discover) where the problem originates.
> I suspect that something isn't getting bound correctly in .editrc --  
> I can probably deal with this in an ipython profile but not sure.  
> Again, if I can understand what "multi-line history" means maybe I  
> can be more intelligent. Looking at that bug report may remind me.

So what I mean is that, in iPython, if I enter in anything that spans  
more than one line, such as a function definition.  Say it's this:

def dog():
     print 'bark'

and then I want to edit that (e.g. because what I really want is for  
dog() to print 'woof'). So I hit the up-arrow key to insert the  
previous history entry into the current line.  But when I do the  
terminal formatting becomes corrupted - for example, the cursor is out  
in the middle of the row, and so on.  It makes editing almost  

I think there was a better example in my original post.  It's easier  
to show than to explain, but you'd know it if you saw it.  It happens  
with stock Leopard & current iPython.

I too prefer to use the stock python framework on Leopard, since I  
tend to use a lot of PyObjC and bridged frameworks, not to mention I  
don't want to have to customize every system I might use.


>> I can/will log a bug, but I'd like to figure out the specifics -- I
>> don't think that 'multi-line history in iPython borked' would get the
>> right attention.  If anyone has anymore insight as to _why_ this
>> occurs, please let me know.
>> Meanwhile I think I'll try to compile readline for my system -- it's
>> better software (than libedit) anyway.
> Readline is easy to compile on Leopard; I use MacPorts to build a  
> Python 2.5.1 with GNU readline. There are a number of dependencies,  
> mostly internationalization stuff, if I recall correctly; I have all  
> that solved via MacPorts. I can provide these port files, or a  
> binary installer for a Python 2.5.1 with readline, if you like.
> I see a mention of dtrace support in Apple's Python. Hmm. I don't  
> know that the binary needs to do anything special to provide dtrace  
> -- I don't think you need to compile in any "hooks", that's the  
> whole point of dtrace. In any event I'll take a look at Apple's  
> source, if any, and see if we can't get a Leopard Python/readline  
> set up.
> But I have a strong preference for using the system Python in  
> Leopard, so I'd like to solve the libedit readline issues if possible.
>  - boyd
> Boyd Waters
> Scientific Programmer
> National Radio Astronomy Observatory
> Socorro, New Mexico

More information about the IPython-dev mailing list