summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-06-07 10:42:40 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-06-07 10:42:40 -0400
commitc09e99341d5ba8aa0775cd312b359da084013a29 (patch)
tree7b1a8d83d35417cf886cd6586b78fd727b4b8859
parentb18c2e8891ae30cf546d7137492e36d6c52b3044 (diff)
downloadcmd2-git-c09e99341d5ba8aa0775cd312b359da084013a29.tar.gz
OSError is enough to catch the errors we are concerned with
-rw-r--r--cmd2/cmd2.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 3f000318..289c44ae 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1842,7 +1842,7 @@ class Cmd(cmd.Cmd):
mode = 'a'
try:
sys.stdout = self.stdout = open(os.path.expanduser(statement.output_to), mode)
- except (FileNotFoundError, OSError) as ex:
+ except OSError as ex:
self.perror('Not Redirecting because - {}'.format(ex), traceback_war=False)
self.redirecting = False
else:
@@ -2885,7 +2885,7 @@ a..b, a:b, a:, ..b items by indices (inclusive)
try:
with open(transcript_file, 'w') as fout:
fout.write(transcript)
- except (FileNotFoundError, OSError) as ex:
+ except OSError as ex:
self.perror('Failed to save transcript: {}'.format(ex), traceback_war=False)
else:
# and let the user know what we did