import readline
import atexit
import os

# tab complete
import rlcompleter
if 'libedit' in readline.__doc__:
    readline.parse_and_bind("bind ^I rl_complete")
else:
    readline.parse_and_bind("tab: complete")
# history file
histfile = os.path.join(os.environ['HOME'], '.py_history')
try:
	readline.write_history_file(histfile)
except IOError:
       pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter, atexit
