Skip to content

Instantly share code, notes, and snippets.

@walterrenner
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterrenner/6eae1ade0f7bcbf950b4 to your computer and use it in GitHub Desktop.
Save walterrenner/6eae1ade0f7bcbf950b4 to your computer and use it in GitHub Desktop.
import atexit
import os
import sys
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind('tab:complete')
print(".pythonrc :: AutoCompletion Loaded")
# History
historyPath = os.path.expanduser("~/.pyhistory")
def save_history(historyPath=historyPath):
import readline
readline.write_history_file(historyPath)
print(".pythonrc :: history saved to " + historyPath)
if os.path.exists(historyPath):
readline.read_history_file(historyPath)
atexit.register(save_history)
# anything not deleted (sys and os) will remain in the interpreter session
del atexit, readline, rlcompleter, save_history, historyPath
@walterrenner
Copy link
Author

Todo:

  • load datetime
  • load django models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment