# HG changeset patch # User Brian Neal # Date 1370480938 18000 # Node ID 357906c82c1ffc669a494a24508737ecad3cd46c # Parent 0c225d280b0601659972fa4ec81d771ec3d57d00 Silently fail instead of traceback if executed on Windows. diff -r 0c225d280b06 -r 357906c82c1f python/.pythonstartup --- a/python/.pythonstartup Tue Jun 04 19:25:17 2013 -0500 +++ b/python/.pythonstartup Wed Jun 05 20:08:58 2013 -0500 @@ -1,15 +1,23 @@ -# python startup file -import readline -import rlcompleter -import atexit -import os -# tab completion -readline.parse_and_bind('tab: complete') -# history file -histfile = os.path.join(os.environ['HOME'], '.pythonhistory') -try: - readline.read_history_file(histfile) -except IOError: - pass -atexit.register(readline.write_history_file, histfile) -del os, histfile, readline, rlcompleter +# python startup file +try: + import readline +except ImportError: + pass +else: + import atexit + import os + import rlcompleter + + # tab completion + readline.parse_and_bind('tab: complete') + + # history file + histfile = os.path.join(os.environ['HOME'], '.pythonhistory') + try: + readline.read_history_file(histfile) + except IOError: + pass + readline.set_history_length(1024) + + atexit.register(readline.write_history_file, histfile) + del os, histfile, readline, rlcompleter