diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | cmd2/cmd2.py | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index be38ceb9..9bb30141 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Fixed bug where setting `always_show_hint=True` did not show a hint when completing `Settables` * Fixed bug in editor detection logic on Linux systems that do not have `which` * Fixed bug in table creator where column headers with tabs would result in an incorrect width calculation + * Fixed `FileNotFoundError` which occurred when running `history --clear` and no history file existed. * Enhancements * Added `silent_startup_script` option to `cmd2.Cmd.__init__()`. If `True`, then the startup script's output will be suppressed. Anything written to stderr will still display. diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 8ad3f7ba..ab72f1a6 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3989,7 +3989,10 @@ class Cmd(cmd.Cmd): self.history.clear() if self.persistent_history_file: - os.remove(self.persistent_history_file) + try: + os.remove(self.persistent_history_file) + except FileNotFoundError: + pass if rl_type != RlType.NONE: readline.clear_history() |