[IPython-user] {solved} tab and arrow problems under cygwin after import

Jeff Kaufman cbr@sccs.swarthmore....
Mon Sep 22 09:37:05 CDT 2008


   [ I just figured this out, but thought someone else might encounter
     the same issue at some point ]

Problem:

  I just started looking into ipython, and it looks really great.
  Unfortunately, I'm currently stuck on some weird interactive
  behavior.  When I start ipython, it will respond nicely to up and
  down arrows for history and tab completion works great.  So I can
  do:

    In [1]: import ma<TAB>
    macpath      mailbox      markupbase   math         
    macurl2path  mailcap      marshal      

    In [1]: import math

    In [2]: 

  Everything works fine, until I import a large custom module:

    In [2]: import module

    In [3]: impo<TAB>

  The tab does nothing except jump to the next tabstop.  The arrows also
  stop working:

    In [3]: impo    <C-c>
    KeyboardInterrupt

    In [3]: <UP>^[[A

  That is, pressing the up arrow prints "^[[A".

  It sounds to me like importing this module is breaking readline
  somehow.  This happens even if I turn off colors.

  I'm using:
    ipython on tcsh on ssh (to linux) on xterm on cygwin on windows XP

Solution:

  The module had the following code:

    import sys
    import codecs
    ...
    sys.stdout = codecs.lookup('utf-8')[3](sys.stdout)

  The code looks like it is supposed to take any unicode sent to
  stdout and encode it as utf-8.  But it seems hackish.  I think I can
  work around it.



Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20080922/c43cbffa/attachment.bin 


More information about the IPython-user mailing list