##// END OF EJS Templates
Handle corruption of JSON history file.
Thomas Kluyver -
Show More
@@ -147,7 +147,10 b' class HistoryManager(object):'
147 """Reload the input history from disk file."""
147 """Reload the input history from disk file."""
148
148
149 with open(self.hist_file,'rt') as hfile:
149 with open(self.hist_file,'rt') as hfile:
150 hist = json.load(hfile)
150 try:
151 hist = json.load(hfile)
152 except ValueError: # Ignore it if JSON is corrupt.
153 return
151 self.input_hist_parsed = hist['parsed']
154 self.input_hist_parsed = hist['parsed']
152 self.input_hist_raw = hist['raw']
155 self.input_hist_raw = hist['raw']
153 if self.shell.has_readline:
156 if self.shell.has_readline:
General Comments 0
You need to be logged in to leave comments. Login now