Skip to content

Instantly share code, notes, and snippets.

@BlueSkyDetector
Created April 6, 2012 14:58
Show Gist options
  • Save BlueSkyDetector/2320582 to your computer and use it in GitHub Desktop.
Save BlueSkyDetector/2320582 to your computer and use it in GitHub Desktop.
completer setting for python interactive shell
# add following line to .bashrc
#PYTHONSTARTUP=$HOME/.pythonrc.py
#export PYTHONSTARTUP
try:
import readline
import rlcompleter
pass
except ImportError, error_string:
print 'ImportError: %s' % error_string
pass
else:
readline.parse_and_bind('tab: complete')
try:
import os
hist = os.path.join(os.environ['HOME'], '.pyhist')
if os.access(hist, os.F_OK) :
readline.read_history_file(hist)
pass
import atexit
atexit.register(readline.write_history_file, hist)
del os, atexit
pass
except ImportError, errro_string:
print 'ImportError: %s' % error_string
pass
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment