From 6e9042e2007477ea5b44f2b5821fdb606185cc46 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Wed, 26 Jun 2013 16:58:09 -0500
Subject: [PATCH] Don't whine about missing shell history file

---
 pytools/debug.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/pytools/debug.py b/pytools/debug.py
index b57f91a..064913a 100644
--- a/pytools/debug.py
+++ b/pytools/debug.py
@@ -144,15 +144,18 @@ def get_shell_hist_filename():
 
 
 def setup_readline():
-    try:
-        readline.read_history_file(get_shell_hist_filename())
-    except Exception:
-        # http://docs.python.org/3/howto/pyporting.html#capturing-the-currently-raised-exception  # noqa
-        import sys
-        e = sys.exc_info()[1]
-
-        from warnings import warn
-        warn("Error opening readline history file: %s" % e)
+    from os.path import exists
+    hist_filename = get_shell_hist_filename()
+    if exists(hist_filename):
+        try:
+            readline.read_history_file(hist_filename)
+        except Exception:
+            # http://docs.python.org/3/howto/pyporting.html#capturing-the-currently-raised-exception  # noqa
+            import sys
+            e = sys.exc_info()[1]
+
+            from warnings import warn
+            warn("Error opening readline history file: %s" % e)
 
     readline.parse_and_bind("tab: complete")
 
-- 
GitLab