diff options
author | Alberto Sartori <alberto.sartori.as@gmail.com> | 2018-03-12 18:19:28 +0100 |
---|---|---|
committer | Alberto Sartori <alberto.sartori.as@gmail.com> | 2018-03-12 18:19:28 +0100 |
commit | 583effc931f50208c949f55ce4fed90cc01e57f8 (patch) | |
tree | 1edc27e9f567965534a0b210bef6a6317dcde1b2 /cmd2.py | |
parent | d278b62c9109a1e91342cbf7119d0578ace11304 (diff) | |
download | cmd2-git-583effc931f50208c949f55ce4fed90cc01e57f8.tar.gz |
FileNotFoundError does not exists on python 2
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -95,11 +95,12 @@ try: except ImportError: pass -# BrokenPipeError is only in Python 3. Use IOError for Python 2. +# BrokenPipeError and FileNotFoundError exist only in Python 3. Use IOError for Python 2. if six.PY3: BROKEN_PIPE_ERROR = BrokenPipeError + FILE_NOT_FOUND_ERROR = FileNotFoundError else: - BROKEN_PIPE_ERROR = IOError + BROKEN_PIPE_ERROR = FILE_NOT_FOUND_ERROR = IOError # On some systems, pyperclip will import gtk for its clipboard functionality. # The following code is a workaround for gtk interfering with printing from a background @@ -1075,7 +1076,7 @@ class Cmd(cmd.Cmd): readline.read_history_file(persistent_history_file) # default history len is -1 (infinite), which may grow unruly readline.set_history_length(persistent_history_length) - except FileNotFoundError: + except FILE_NOT_FOUND_ERROR: pass atexit.register(readline.write_history_file, persistent_history_file) |