2010-11-01 14:51:16 -07:00
|
|
|
import atexit
|
|
|
|
import os
|
|
|
|
import readline
|
|
|
|
import rlcompleter
|
|
|
|
|
|
|
|
historyPath = os.path.expanduser("~/.pyhistory")
|
|
|
|
|
2011-09-17 14:38:49 -07:00
|
|
|
|
2010-11-01 14:51:16 -07:00
|
|
|
def save_history(historyPath=historyPath):
|
2011-09-17 14:38:49 -07:00
|
|
|
import readline
|
|
|
|
readline.write_history_file(historyPath)
|
2010-11-01 14:51:16 -07:00
|
|
|
|
|
|
|
if os.path.exists(historyPath):
|
2011-09-17 14:38:49 -07:00
|
|
|
readline.read_history_file(historyPath)
|
2010-11-01 14:51:16 -07:00
|
|
|
|
|
|
|
atexit.register(save_history)
|
|
|
|
del os, atexit, readline, rlcompleter, save_history, historyPath
|