Mercurial > public > dotfiles
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:0c225d280b06 | 14:357906c82c1f |
---|---|
1 # python startup file | 1 # python startup file |
2 import readline | 2 try: |
3 import rlcompleter | 3 import readline |
4 import atexit | 4 except ImportError: |
5 import os | 5 pass |
6 # tab completion | 6 else: |
7 readline.parse_and_bind('tab: complete') | 7 import atexit |
8 # history file | 8 import os |
9 histfile = os.path.join(os.environ['HOME'], '.pythonhistory') | 9 import rlcompleter |
10 try: | 10 |
11 readline.read_history_file(histfile) | 11 # tab completion |
12 except IOError: | 12 readline.parse_and_bind('tab: complete') |
13 pass | 13 |
14 atexit.register(readline.write_history_file, histfile) | 14 # history file |
15 del os, histfile, readline, rlcompleter | 15 histfile = os.path.join(os.environ['HOME'], '.pythonhistory') |
16 try: | |
17 readline.read_history_file(histfile) | |
18 except IOError: | |
19 pass | |
20 readline.set_history_length(1024) | |
21 | |
22 atexit.register(readline.write_history_file, histfile) | |
23 del os, histfile, readline, rlcompleter |