Mercurial > public > dotfiles
annotate python/.pythonstartup @ 14:357906c82c1f
Silently fail instead of traceback if executed on Windows.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 05 Jun 2013 20:08:58 -0500 |
parents | 71f65ccb96f0 |
children |
rev | line source |
---|---|
bgneal@14 | 1 # python startup file |
bgneal@14 | 2 try: |
bgneal@14 | 3 import readline |
bgneal@14 | 4 except ImportError: |
bgneal@14 | 5 pass |
bgneal@14 | 6 else: |
bgneal@14 | 7 import atexit |
bgneal@14 | 8 import os |
bgneal@14 | 9 import rlcompleter |
bgneal@14 | 10 |
bgneal@14 | 11 # tab completion |
bgneal@14 | 12 readline.parse_and_bind('tab: complete') |
bgneal@14 | 13 |
bgneal@14 | 14 # history file |
bgneal@14 | 15 histfile = os.path.join(os.environ['HOME'], '.pythonhistory') |
bgneal@14 | 16 try: |
bgneal@14 | 17 readline.read_history_file(histfile) |
bgneal@14 | 18 except IOError: |
bgneal@14 | 19 pass |
bgneal@14 | 20 readline.set_history_length(1024) |
bgneal@14 | 21 |
bgneal@14 | 22 atexit.register(readline.write_history_file, histfile) |
bgneal@14 | 23 del os, histfile, readline, rlcompleter |