##// END OF EJS Templates
Made 'old' readline work again (GetOutpuFile was not exported ...
vivainio -
Show More
@@ -1,45 +1,48 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """ Imports and provides the "correct" version of readline for the platform.
2 """ Imports and provides the "correct" version of readline for the platform.
3
3
4 Readline is used throughout IPython as "import IPython.rlineimpl as readline.
4 Readline is used throughout IPython as "import IPython.rlineimpl as readline.
5
5
6 In addition to normal readline stuff, this module provides have_readline boolean
6 In addition to normal readline stuff, this module provides have_readline boolean
7 and _outputfile variable used in genutils.
7 and _outputfile variable used in genutils.
8
8
9 $Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $"""
9 $Id: Magic.py 1096 2006-01-28 20:08:02Z vivainio $"""
10
10
11
11
12 import sys
12 import sys
13
13
14 have_readline = False
14 have_readline = False
15
15
16 if sys.platform == 'win32':
16 if sys.platform == 'win32':
17 try:
17 try:
18 from pyreadline import *
18 from pyreadline import *
19 print "Using the new pyreadline (thanks for participating in the testing!)"
19 print "Using the new pyreadline (thanks for participating in the testing!)"
20 have_readline = True
20 have_readline = True
21 import pyreadline as _rl
21 except ImportError:
22 except ImportError:
22 print "The IPython team recommends the new pyreadline for Windows use, it wasn't found."
23 print "IPython team recommends the new pyreadline for Windows use, it wasn't found."
23 print "It's superior especially with non-US keyboard layouts."
24 print "It's superior especially with non-US keyboard layouts."
24 print "Try installing it with 'easy_install pyreadline (ctypes is required) or"
25 print "Try installing it with 'easy_install pyreadline (ctypes is required) or"
25 print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline"
26 print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline"
26 print "Trying 'old' windows readline."
27 print "Trying 'old' windows readline."
27
28
28 try:
29 try:
29 from readline import *
30 from readline import *
31 import readline as _rl
30 have_readline = True
32 have_readline = True
31 except ImportError:
33 except ImportError:
32 pass
34 pass
33
35
34 if have_readline:
36 if have_readline:
35 try:
37 try:
36 _outputfile=GetOutputFile()
38 _outputfile=_rl.GetOutputFile()
37 except NameError:
39 except NameError:
40 print "Failed GetOutputFile"
38 have_readline = False
41 have_readline = False
39
42
40 else:
43 else:
41 try:
44 try:
42 from readline import *
45 from readline import *
43 have_readline = True
46 have_readline = True
44 except ImportError:
47 except ImportError:
45 pass
48 pass
General Comments 0
You need to be logged in to leave comments. Login now