File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 6464
6565# Prefer statically linked gnureadline if available (for Mac OS X compatibility due to issues with libedit)
6666try :
67- import gnureadline
67+ import gnureadline as readline
6868except ImportError :
69- import readline
69+ try :
70+ import readline
71+ except ImportError :
72+ pass
7073
7174# Python 3 compatibility hack due to no built-in file keyword in Python 3
7275# Due to one occurrence of isinstance(<foo>, file) checking to see if something is of file type
@@ -1132,9 +1135,12 @@ def _cmdloop(self):
11321135 # An almost perfect copy from Cmd; however, the pseudo_raw_input portion
11331136 # has been split out so that it can be called separately
11341137 if self .use_rawinput and self .completekey :
1135- self .old_completer = readline .get_completer ()
1136- readline .set_completer (self .complete )
1137- readline .parse_and_bind (self .completekey + ": complete" )
1138+ try :
1139+ self .old_completer = readline .get_completer ()
1140+ readline .set_completer (self .complete )
1141+ readline .parse_and_bind (self .completekey + ": complete" )
1142+ except NameError :
1143+ pass
11381144 stop = None
11391145 try :
11401146 while not stop :
@@ -1148,7 +1154,10 @@ def _cmdloop(self):
11481154 stop = self .onecmd_plus_hooks (line )
11491155 finally :
11501156 if self .use_rawinput and self .completekey :
1151- readline .set_completer (self .old_completer )
1157+ try :
1158+ readline .set_completer (self .old_completer )
1159+ except NameError :
1160+ pass
11521161 return stop
11531162
11541163 # noinspection PyUnusedLocal
You can’t perform that action at this time.
0 commit comments