Created
February 12, 2013 18:31
-
-
Save Ry4an/4772069 to your computer and use it in GitHub Desktop.
For getting history in python REPL. Mostly cribbed from stackoverflow answers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import atexit | |
import os | |
import re | |
import readline | |
import rlcompleter | |
import socket | |
import _socket | |
import sys | |
import time | |
try: | |
from dramafever.episode.models import * | |
except: | |
pass | |
history = os.path.expanduser('~/.python_history') | |
readline.read_history_file(history) | |
if 'libedit' in readline.__doc__: | |
readline.parse_and_bind("bind ^I rl_complete") | |
else: | |
readline.parse_and_bind("tab: complete") | |
atexit.register(readline.write_history_file, history) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment