Show More
@@ -1,53 +1,54 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 | import pyreadline.rlmain |
|
18 | import pyreadline.rlmain | |
19 | #add config for inputrcpath here: |
|
19 | #add config for inputrcpath here: | |
20 | #pyreadline.rlmain.config_path="c:/python/test_config.ini" |
|
20 | #pyreadline.rlmain.config_path="c:/python/test_config.ini" | |
21 | from readline import * |
|
21 | from readline import * | |
22 | print "Using the new pyreadline (thanks for participating in the testing!)" |
|
22 | #print "Using the new pyreadline (thanks for participating in the testing!)" | |
23 |
|
23 | |||
24 | have_readline = True |
|
24 | have_readline = True | |
25 |
|
25 | |||
26 | import readline as _rl |
|
26 | import readline as _rl | |
27 | except ImportError: |
|
27 | except ImportError: | |
28 |
print "IPython team recommends the new pyreadline for Windows use, |
|
28 | #print "IPython team recommends the new pyreadline for Windows use, " | |
29 | print "It's superior especially with non-US keyboard layouts." |
|
29 | #print "It's superior especially with non-US keyboard layouts." | |
30 | print "Try installing it with 'easy_install pyreadline (ctypes is required) or" |
|
30 | #print "Try installing it with 'easy_install pyreadline (ctypes is required) or" | |
31 | print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" |
|
31 | #print "svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk pyreadline" | |
32 | print "Trying 'old' windows readline." |
|
32 | #print "Trying 'old' windows readline." | |
33 |
|
33 | print "Using 'old' readline, you might want to try pyreadline:" | ||
|
34 | print "http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro" | |||
34 | try: |
|
35 | try: | |
35 | from readline import * |
|
36 | from readline import * | |
36 | import readline as _rl |
|
37 | import readline as _rl | |
37 | have_readline = True |
|
38 | have_readline = True | |
38 | except ImportError: |
|
39 | except ImportError: | |
39 | pass |
|
40 | pass | |
40 |
|
41 | |||
41 | if have_readline: |
|
42 | if have_readline: | |
42 | try: |
|
43 | try: | |
43 | _outputfile=_rl.GetOutputFile() |
|
44 | _outputfile=_rl.GetOutputFile() | |
44 | except NameError: |
|
45 | except NameError: | |
45 | print "Failed GetOutputFile" |
|
46 | print "Failed GetOutputFile" | |
46 | have_readline = False |
|
47 | have_readline = False | |
47 |
|
48 | |||
48 | else: |
|
49 | else: | |
49 | try: |
|
50 | try: | |
50 | from readline import * |
|
51 | from readline import * | |
51 | have_readline = True |
|
52 | have_readline = True | |
52 | except ImportError: |
|
53 | except ImportError: | |
53 | pass |
|
54 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now