- #if 'libedit' in readline.__doc__:
- # readline.parse_and_bind("bind ^I rl_complete")
- #else:
- # readline.parse_and_bind("tab: complete")
-
- histfile = os.path.expanduser('~/.python_history')
- try:
- readline.read_history_file(histfile)
- except IOError:
- pass # No such file
+ # if 'libedit' in readline.__doc__:
+ # readline.parse_and_bind("bind ^I rl_complete")
+ # else:
+ # readline.parse_and_bind("tab: complete")
+
+ histfiles = ['~/.python_history']
+ # if 'VIRTUAL_ENV' in os.environ:
+ # histfiles.append('$VIRTUAL_ENV/.python_history')
+ for histfile in histfiles:
+ try:
+ histfile = os.path.expandvars(histfile)
+ histfile = os.path.expanduser(histfile)
+ readline.read_history_file(histfile)
+ except IOError:
+ pass # No such file