[IPython-user] Readline for Windows

Voidspace mike at pcblokes.com
Wed May 5 11:00:22 CDT 2004



Voidspace wrote:

>
>
> Fernando Perez wrote:
>
>> Voidspace wrote:
>>
>>> There is a readline module for windows :
>>> http://newcenturycomputers.net/projects/readline.html
>>>
>>> If this is installed - Ipython crashes horribly................
>>> It obvioucly has different attributes to the Linux 
>>> version................
>>
>>
>>
>> Crashes horribly... Could you please be more specific?  Without a 
>> traceback, it will be very hard to know what's going on here.  Feel 
>> free to post the full traceback, or if you get an ipython crash 
>> report post that. 
>
>
>
> I posted the crash report a couple of weeks ago.... and there was no 
> response..........
> I worked out for myself that it was readline causing the problem - but 
> without readline features Ipython isn't *that much* better than an 
> ordinary console window for me :-(
>
> I'll see if I can still find it............... 

Found it :

***************************************************************************

IPython post-mortem report

IPython version: 0.5.0

Platform info  : os.name -> nt, sys.platform -> win32

***************************************************************************

Current user configuration structure:

{'Version': 0,
 'alias': [],
 'args': [],
 'autocall': 1,
 'autoindent': 0,
 'automagic': 1,
 'banner': 1,
 'c': '',
 'cache_size': 1000,
 'classic': 0,
 'color_info': 1,
 'colors': 'NoColor',
 'confirm_exit': 1,
 'debug': 0,
 'deep_reload': 0,
 'editor': '0',
 'execfile': [],
 'execute': [],
 'help': 0,
 'ignore': 0,
 'import_all': [],
 'import_mod': [],
 'import_some': [[]],
 'include': [],
 'ipythondir': 'C:\\Documents and Settings\\michael\\.ipython',
 'log': 0,
 'logfile': '',
 'logplay': '',
 'magic_docstrings': 0,
 'messages': 1,
 'nosep': 0,
 'opts': Struct({}),
 'pdb': 0,
 'pprint': 1,
 'profile': '',
 'prompt_in1': 'In [%n]:',
 'prompt_in2': '   .%n.:',
 'prompt_out': 'Out[%n]:',
 'quick': 0,
 'rcfile': 'ipythonrc.ini',
 'readline': 1,
 'readline_omit__names': 0,
 'readline_parse_and_bind': ['tab: complete',
                             '"\\C-l": possible-completions',
                             'set show-all-if-ambiguous on',
                             '"\\C-o": tab-insert',
                             '"\\M-i": "    "',
                             '"\\M-o": "\\d\\d\\d\\d"',
                             '"\\M-I": "\\d\\d\\d\\d"',
                             '"\\C-r": reverse-search-history',
                             '"\\C-s": forward-search-history',
                             '"\\C-p": history-search-backward',
                             '"\\C-n": history-search-forward'],
 'readline_remove_delims': '\'"[]{}-/~',
 'screen_length': 0,
 'separate_in': '\\n',
 'separate_out': '0',
 'separate_out2': '0',
 'upgrade': 0,
 'xmode': 'Context'}

***************************************************************************

Crash traceback:

---------------------------------------------------------------------------
AttributeError                         Python 2.3.3: D:\Python23\python.exe
                                                   Wed May 05 16:49:11 2004
A problem occured executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.

C:\Program Files\IPython\IPython_shell.py
     -3 """
     -2
     -1 import IPython
      0 IPython.Shell.IPShell().mainloop()

D:\PYTHON23\Lib\site-packages\IPython\Shell.py in 
__init__(self=<IPython.Shell.IPShell instance at 0x009E1B98>, 
argv=[r'C:\Program Files\IPython\IPython_shell.py'], user_ns=None, debug=0)
     26 from ipmaker import make_IPython
     27 from genutils import qw
     28 import ultraTB
     29
     30 
#-----------------------------------------------------------------------------
     31 # This class is trivial now, but I want to have it in to publish 
a clean
     32 # interface. Later when the internals are reorganized, code that 
uses this
     33 # shouldn't have to change.
     34
     35 class IPShell:
     36     """Create an IPython instance."""
     37    
     38     def __init__(self,argv=None,user_ns=None,debug=0):
     39         if argv is None:
     40             argv = sys.argv
---> 41         self.IP = make_IPython(argv,user_ns=user_ns,debug=debug)
        self = <IPython.Shell.IPShell instance at 0x009E1B98>, global IP 
= undefined, global make_IPython = <function make_IPython at 
0x009F6EF0>, argv = [r'C:\Program Files\IPython\IPython_shell.py'], 
user_ns = None, debug = 0
     42
     43     def mainloop(self,sys_exit=0):
     44         self.IP.mainloop()
     45         if sys_exit:
     46             sys.exit()
     47
     48 # alias for backwards compatibility
     49 IPythonShell = IPShell
     50
     51 
#-----------------------------------------------------------------------------
     52 class IPShellEmbed:
     53     """Allow embedding an IPython shell into a running program.
     54
     55     Instances of this class are callable, with the __call__ 
method being an
     56     alias to the embed() method of an InteractiveShell instance.

D:\PYTHON23\Lib\site-packages\IPython\ipmaker.py in 
make_IPython(argv=[r'C:\Program Files\IPython\IPython_shell.py'], 
user_ns=None, debug=0, rc_override=None)
    476     # wouldn't worry about this stuff!
    477
    478     if IP.rc.classic:
    479         IP.rc.quick = 1
    480         IP.rc.cache_size = 0
    481         IP.rc.pprint = 0
    482         IP.rc.prompt_in1 = '>>> '
    483         IP.rc.prompt_in2 = '... '
    484         IP.rc.prompt_out = ''
    485         IP.rc.separate_in = IP.rc.separate_out = 
IP.rc.separate_out2 = '0'
    486         IP.rc.colors = 'NoColor'
    487         IP.rc.xmode = 'Plain'
    488
    489     # configure readline
    490     if IP.rc.readline:
--> 491         IP.init_readline()
        IP = <IPython.iplib.InteractiveShell instance at 0x009EFF58>, 
global init_readline = undefined
    492
    493     # update exception handlers with rc file status
    494     otrap.trap_out()  # I don't want these messages ever.
    495     IP.magic_xmode(IP.rc.xmode)
    496     otrap.release_out()
    497
    498     # activate logging if requested and not reloading a log
    499     if IP.rc.logplay:
    500         IP.magic_logstart(IP.rc.logplay + ' append')
    501     elif  IP.rc.logfile:
    502         IP.magic_logstart(IP.rc.logfile)
    503     elif IP.rc.log:
    504         IP.magic_logstart()
    505
    506     # find user editor so that it we don't have to look it up 
constantly

D:\PYTHON23\Lib\site-packages\IPython\iplib.py in 
init_readline(self=<IPython.iplib.InteractiveShell instance at 0x009EFF58>)
    588                 #print '*** Reading readline history'  # dbg
    589                 readline.read_history_file(self.histfile)
    590             except IOError:
    591                 pass  # It doesn't exist yet.
    592
    593             atexit.register(self.savehist)
    594             del atexit
    595
    596         except ImportError,msg:
    597             self.has_readline = 0
    598             # no point in bugging windows users with this every 
time:
    599             if os.name == 'posix':
    600                 warn('Readline services not available on this 
platform.')
    601
    602         except KeyError:
--> 603             pass  # under windows, no environ['term'] key

    604
    605         # Configure auto-indent for all platforms
    606         self.set_autoindent(self.rc.autoindent)
    607
    608     def showsyntaxerror(self, filename=None):
    609         """Display the syntax error that just occurred.
    610
    611         This doesn't display a stack trace because there isn't one.
    612
    613         If a filename is given, it is stuffed in the exception 
instead
    614         of what was there before (because Python's parser always 
uses
    615         "<string>" when reading from a string).
    616         """
    617         type, value, sys.last_traceback = sys.exc_info()
    618         sys.last_type = type

D:\PYTHON23\Lib\site-packages\IPython\iplib.py in 
__init__(self=<IPython.iplib.MagicCompleter instance at 0x00A59238>, 
namespace={'In': ['\n'], 'Out': {}, '__IP': 
<IPython.iplib.InteractiveShell instance at 0x009EFF58>, '__builtins__': 
<module '__builtin__' (built-in)>, '__name__': '__main__', '_dh': 
[r'H:\My Documents'], '_ih': ['\n'], '_oh': {}, 'help': Type help() for 
interactive help, or help(object) for help about object.}, omit__names=0)
     86
     87     class MagicCompleter(FlexCompleter.Completer):
     88         """Extension of the completer class to work on 
@-prefixed lines."""
     89
     90         def __init__(self, namespace = None, omit__names = 0):
     91             """MagicCompleter(namespace = None, omit__names = 0) 
-> completer
     92
     93             Return a completer object suitable for use by the 
readline library
     94             via readline.set_completer().
     95
     96             The optional omit__names parameter sets the 
completer to omit the
     97             'magic' names (__magicname__) for python objects 
unless the text
     98             to be completed explicitly starts with one or more 
underscores."""
     99
    100             FlexCompleter.Completer.__init__(self,namespace)
--> 101             delims = FlexCompleter.readline.get_completer_delims()
        delims = undefined, global FlexCompleter = <module 
'IPython.FlexCompleter' from 
'D:\Python23\Lib\site-packages\IPython\FlexCompleter.pyc'>, global 
readline = undefined, global get_completer_delims = undefined
    102             delims = delims.replace('@','')
    103             FlexCompleter.readline.set_completer_delims(delims)
    104             self.omit__names = omit__names
    105
    106         # Code contributed by Alex Schmolck, for ipython/emacs 
integration
    107         def all_completions(self, text):
    108             """Return all possible completions for the benefit 
of emacs."""
    109            
    110             completions = []
    111             try:
    112                 for i in xrange(sys.maxint):
    113                     res = self.complete(text, i)
    114
    115                     if not res: break
    116

AttributeError: 'module' object has no attribute 'get_completer_delims'

***************************************************************************

History of session input:

*** Last line of input (may not be in above history):





>
>
>>
>>
>> Note that if they decided to implement the completion protocol in a 
>> manner very different to GNU readline, it will be pretty much 
>> impossible for me to make it work.  But I know that ipython works ok 
>> with Gary Bishop's python tools, which include readline and color 
>> support, so perhaps that might help you.
>
>
> I've googled - but can't find any reference to 'Gary Bishop's python 
> tools'... are they for cygwin python or 'real python' ? :-)
>
> Regards,
>
> Fuzzy
>
>
>>
>> Regards,
>>
>> f.
>>
>>
>>
>>
>>
>>
>

-- 

http://www.Voidspace.org.uk 
The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fiction and more. 

---
http://www.atlantibots.org.uk
http://groups.yahoo.com/group/atlantis_talk/
Atlantibots - stomping across the worlds of Atlantis.
Building with Python - programming language that rules the world.
---
http://www.fuchsiashockz.co.uk   
http://groups.yahoo.com/group/void-shockz
---

Everyone has talent. What is rare is the courage to follow talent
 to the dark place where it leads. -Erica Jong
Ambition is a poor excuse for not having sense enough to be lazy.
         -Milan Kundera






More information about the IPython-user mailing list