summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-10-08 18:55:26 -0400
committerGitHub <noreply@github.com>2019-10-08 18:55:26 -0400
commitd0e18f1123e1f3ae0d0a93f737867fdb266d32b8 (patch)
tree6df2f439427efe20faf03598bf819ce671b8f04b
parent8b45f3a274c22168be8c4582fe38b4a0b02821b5 (diff)
parent32efbfbd244765adc5179f6a147af5ef1ca828ad (diff)
downloadcmd2-git-d0e18f1123e1f3ae0d0a93f737867fdb266d32b8.tar.gz
Merge pull request #786 from python-cmd2/history_error
Fixed ValueError exception when opening old history file
-rw-r--r--CHANGELOG.md4
-rw-r--r--cmd2/cmd2.py5
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a9ff6c3..6dc3a857 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.9.19 (TBD, 2019)
+* Bug Fixes
+ * Fixed `ValueError` exception which could occur when an old format persistent history file is loaded with new `cmd2`
+
## 0.9.18 (October 1, 2019)
* Bug Fixes
* Fixed bug introduced in 0.9.17 where help functions for hidden and disabled commands were not being filtered
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 5e1f9a72..84945535 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3592,8 +3592,9 @@ class Cmd(cmd.Cmd):
try:
with open(hist_file, 'rb') as fobj:
history = pickle.load(fobj)
- except (AttributeError, EOFError, FileNotFoundError, ImportError, IndexError, KeyError, pickle.UnpicklingError):
- # If any non-operating system error occurs when attempting to unpickle, just use an empty history
+ except (AttributeError, EOFError, FileNotFoundError, ImportError, IndexError, KeyError, ValueError,
+ pickle.UnpicklingError):
+ # If any of these errors occur when attempting to unpickle, just use an empty history
pass
except OSError as ex:
msg = "Can not read persistent history file '{}': {}"