##// END OF EJS Templates
Made 'old' readline work again (GetOutpuFile was not exported ...
Made 'old' readline work again (GetOutpuFile was not exported with 'from readline import *', need to access via real module)

File last commit:

r164:c66a3f62
r164:c66a3f62
Show More
rlineimpl.py
48 lines | 1.5 KiB | text/x-python | PythonLexer
vivainio
provide single readline config place through rlineimpl
r161 # -*- coding: utf-8 -*-
""" Imports and provides the "correct" version of readline for the platform.
Readline is used throughout IPython as "import IPython.rlineimpl as readline.
In addition to normal readline stuff, this module provides have_readline boolean
and _outputfile variable used in genutils.
$Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $"""
import sys
have_readline = False
if sys.platform == 'win32':
try:
from pyreadline import *
print "Using the new pyreadline (thanks for participating in the testing!)"
have_readline = True
vivainio
Made 'old' readline work again (GetOutpuFile was not exported ...
r164 import pyreadline as _rl
vivainio
provide single readline config place through rlineimpl
r161 except ImportError:
vivainio
Made 'old' readline work again (GetOutpuFile was not exported ...
r164 print "IPython team recommends the new pyreadline for Windows use, it wasn't found."
vivainio
provide single readline config place through rlineimpl
r161 print "It's superior especially with non-US keyboard layouts."
print "Try installing it with 'easy_install pyreadline (ctypes is required) or"
print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline"
print "Trying 'old' windows readline."
vivainio
Oops, OutputFile was only in Windows readline, fixed.
r162 try:
from readline import *
vivainio
Made 'old' readline work again (GetOutpuFile was not exported ...
r164 import readline as _rl
vivainio
Oops, OutputFile was only in Windows readline, fixed.
r162 have_readline = True
except ImportError:
pass
if have_readline:
try:
vivainio
Made 'old' readline work again (GetOutpuFile was not exported ...
r164 _outputfile=_rl.GetOutputFile()
vivainio
Oops, OutputFile was only in Windows readline, fixed.
r162 except NameError:
vivainio
Made 'old' readline work again (GetOutpuFile was not exported ...
r164 print "Failed GetOutputFile"
vivainio
Oops, OutputFile was only in Windows readline, fixed.
r162 have_readline = False
vivainio
provide single readline config place through rlineimpl
r161 else:
try:
from readline import *
have_readline = True
except ImportError:
pass