Skip to content

Commit 8c5b02a

Browse files
committed
Exception handling for file IO events while saving history.
1 parent 1c9d1b3 commit 8c5b02a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bpython/repl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,10 @@ def push(self, s, insert_into_history=True):
751751
if os.path.exists(histfilename):
752752
self.rl_history.load(histfilename, getpreferredencoding())
753753
self.rl_history.append(s)
754-
self.rl_history.save(histfilename, getpreferredencoding(), self.config.hist_length)
754+
try:
755+
self.rl_history.save(histfilename, getpreferredencoding(), self.config.hist_length)
756+
except EnvironmentError as (errno, strerr):
757+
self.interact.notify("Write error for file: %s. %s " % (histfilename, strerr))
755758

756759
more = self.interp.runsource('\n'.join(self.buffer))
757760

0 commit comments

Comments
 (0)