From 969dab29bbaed194edce881d60643f5e95a02366 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 11 Jul 2018 02:40:26 -0400 Subject: Added --clear argument to history command Added better error checking when loading readline history file Improved some error messages Changed IOError usages to OSError since they were merged in Python 3.3. --- cmd2/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd2/utils.py') diff --git a/cmd2/utils.py b/cmd2/utils.py index 11d48b78..ff8e034e 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -143,7 +143,7 @@ def is_text_file(file_path: str) -> bool: # noinspection PyUnusedLocal if sum(1 for line in f) > 0: valid_text_file = True - except IOError: # pragma: no cover + except OSError: # pragma: no cover pass except UnicodeDecodeError: # The file is not ASCII. Check if it is UTF-8. @@ -153,7 +153,7 @@ def is_text_file(file_path: str) -> bool: # noinspection PyUnusedLocal if sum(1 for line in f) > 0: valid_text_file = True - except IOError: # pragma: no cover + except OSError: # pragma: no cover pass except UnicodeDecodeError: # Not UTF-8 -- cgit v1.2.1