Skip to content

Commit c09e993

Browse files
committed
OSError is enough to catch the errors we are concerned with
1 parent b18c2e8 commit c09e993

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ def _redirect_output(self, statement):
18421842
mode = 'a'
18431843
try:
18441844
sys.stdout = self.stdout = open(os.path.expanduser(statement.output_to), mode)
1845-
except (FileNotFoundError, OSError) as ex:
1845+
except OSError as ex:
18461846
self.perror('Not Redirecting because - {}'.format(ex), traceback_war=False)
18471847
self.redirecting = False
18481848
else:
@@ -2885,7 +2885,7 @@ def _generate_transcript(self, history, transcript_file):
28852885
try:
28862886
with open(transcript_file, 'w') as fout:
28872887
fout.write(transcript)
2888-
except (FileNotFoundError, OSError) as ex:
2888+
except OSError as ex:
28892889
self.perror('Failed to save transcript: {}'.format(ex), traceback_war=False)
28902890
else:
28912891
# and let the user know what we did

0 commit comments

Comments
 (0)