From 8cf8f6d688d369808c51e69cb0e5a1139ecc04b6 Mon Sep 17 00:00:00 2001 From: Derek Harland Date: Wed, 2 Nov 2022 15:00:42 +1300 Subject: [PATCH] Support python-2.7 in enable_vt_processing In `python-2.7`, when running in `msys` or `git-bash` based terminals, calls to `enable_vt_processing` will fail with an `IOError` --- colorama/winterm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colorama/winterm.py b/colorama/winterm.py index aad867e..d58b52b 100644 --- a/colorama/winterm.py +++ b/colorama/winterm.py @@ -190,6 +190,6 @@ def enable_vt_processing(fd): mode = win32.GetConsoleMode(handle) if mode & win32.ENABLE_VIRTUAL_TERMINAL_PROCESSING: return True - # Can get TypeError in testsuite where 'fd' is a Mock() - except (OSError, TypeError): + # Can get TypeError in testsuite where 'fd' is a Mock() and IOError in python2.7 + except (IOError, OSError, TypeError): return False