From e90d6fbaf41a7255f821aa85211fe8f144127908 Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Sat, 25 May 2019 12:25:31 -0700 Subject: [PATCH] Python 3: except exception, e -> except exception as e. Re #7105. --- source/NVDAObjects/IAccessible/__init__.py | 3 ++- source/NVDAObjects/IAccessible/adobeFlash.py | 3 ++- source/nvwave.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/NVDAObjects/IAccessible/__init__.py b/source/NVDAObjects/IAccessible/__init__.py index 526524c612a..f0c9ddcb7bc 100644 --- a/source/NVDAObjects/IAccessible/__init__.py +++ b/source/NVDAObjects/IAccessible/__init__.py @@ -608,7 +608,8 @@ def __init__(self,windowHandle=None,IAccessibleObject=None,IAccessibleChildID=No try: left,top,width,height = IAccessibleObject.accLocation(0) windowHandle=winUser.user32.WindowFromPoint(winUser.POINT(left,top)) - except COMError, e: + # Py3 review required: Syntax of the form "except exception, e" is gone in Python 3, replaced by "except exception as e". + except COMError as e: log.debugWarning("accLocation failed: %s" % e) if not windowHandle: raise InvalidNVDAObject("Can't get a window handle from IAccessible") diff --git a/source/NVDAObjects/IAccessible/adobeFlash.py b/source/NVDAObjects/IAccessible/adobeFlash.py index 159b02921b6..c28472483a9 100644 --- a/source/NVDAObjects/IAccessible/adobeFlash.py +++ b/source/NVDAObjects/IAccessible/adobeFlash.py @@ -21,7 +21,8 @@ def _getStoryText(self): def _getRawSelectionOffsets(self): try: return self.obj.ISimpleTextSelectionObject.GetSelection() - except COMError, e: + # Py3 review required: Syntax of the form "except exception, e" is gone in Python 3, replaced by "except exception as e". + except COMError as e: if e.hresult == hresult.E_FAIL: # The documentation says that an empty field should return 0 for both values, but instead, we seem to get E_FAIL. # An empty field still has a valid caret. diff --git a/source/nvwave.py b/source/nvwave.py index c441e92f3cc..0640e30df97 100644 --- a/source/nvwave.py +++ b/source/nvwave.py @@ -210,7 +210,8 @@ def _feedUnbuffered(self, data, onDone=None): try: with self._global_waveout_lock: winmm.waveOutWrite(self._waveout, LPWAVEHDR(whdr), sizeof(WAVEHDR)) - except WindowsError, e: + # Py3 review required: Syntax of the form "except exception, e" is gone in Python 3, replaced by "except exception as e". + except WindowsError as e: self.close() raise e self.sync()