category=UserWarning)
readline.read_init_file(initfile)
+ try:
+ import pyreadline3.rlmain
+ import pyreadline3.unicode_helper # noqa: F401 imported but unused
+ except ImportError:
+ try:
+ import pyreadline.rlmain
+ import pyreadline.unicode_helper # noqa: F401 unused
+ except ImportError:
+ pass
+
+ # Copied from pyreadline/configuration/startup.py
+ completer_obj = rlcompleter.Completer()
+ # def nop(val, word):
+ # return word
+ # completer_obj._callable_postfix = nop
+ readline.set_completer(completer_obj.complete)
+
+ # activate tab completion
+ readline.parse_and_bind("tab: complete")
+
# if 'libedit' in readline.__doc__:
# readline.parse_and_bind("bind ^I rl_complete")
# else:
import atexit
atexit._exithandlers = []
builtins.unset_history = unset_history2
+
elif hasattr(atexit, '_clear') and callable(atexit._clear):
def unset_history3():
import atexit
atexit._clear()
builtins.unset_history = unset_history3
+
else:
sys.stderr.write('Error: cannot clear exit handlers\n')