def __exit__(self, ex_tp, ex_val, ex_tb):
if not haveReadline:
return False
try:
# update the history for this project
readline.write_history_file(self.historyFile)
except Exception as E:
print "Failed to write history to {0} - {1}".format(self.historyFile, E)
# put back the original history!
readline.clear_history()
readline.read_history_file(self.oldhistFile)
os.unlink(self.oldhistFile)
# and put back the old completer
readline.set_completer(self.oldCompleter)
# linegenerators, pass one of these to the "run"
# method of the CommandLineInterface object
#import ctypes
#rllib = ctypes.cdll.LoadLibrary("libreadline.so")
#rl_line_buffer = ctypes.c_char_p.in_dll(rllib, "rl_line_buffer")
#rl_done = ctypes.c_int.in_dll(rllib, "rl_done")
评论列表
文章目录