[Issues] pylab causes copy/paste limit of 510 characters

Hugo Buddelmeijer astrowise at hugo.doemaarwat.nl
Thu May 21 16:15:25 CEST 2009


Hugo Buddelmeijer schreef:
> I noticed an odd bug with pasting pieces of code in the Astro-WISE 
> prompt, sometimes it misses characters. This seems to be related to 
> pylab, as demonstrated by this example:
> 
> 
> # Start a new awe-prompt and copy and paste this piece of code, it should
> # give you a length of 555 (there should be two lines, one very long):
> 
> a="012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234"
> len(a)
> 
> # Then use pylab to plot something:
> 
> import pylab
> pylab.plot([4,2,3,2,4])
> 
> # Close the graph window and (*important*) press a couple of enters, now
> # paste the first piece of code again, you will get 554 for the length.

I did some more tests, it seems not to be directly related to matplotlib, 
but to an incorrect compilation of readline. Python 2.5.4 fixes the 
issue. A workaround is putting
  #define HAVE_RL_CALLBACK 1
in pyconfig.h before compiling python (the configure of python 2.5.2 does 
that automatically).

> Newer matplotlib versions also have other benefits, such as that they do 
> not require a display since they only actually show figures when you do 
> pylab.show().

FWIW, this can easily be turned of/on with pylab.ioff() pylab.ion()

Hugo


More information about the Issues mailing list