From 1febb9a9351c3b103a8ba6e570bee49c28a93caa Mon Sep 17 00:00:00 2001 From: Shawn Hartsock Date: Thu, 24 Jul 2014 14:12:18 -0400 Subject: [PATCH] python3: more 2 to 3 tool fixes Changes exception statements to match python 3 style partial: https://github.com/vmware/pyvmomi/issues/55 --- pyVim/connect.py | 2 +- pyVmomi/SoapAdapter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyVim/connect.py b/pyVim/connect.py index 10637aa..2970a66 100644 --- a/pyVim/connect.py +++ b/pyVim/connect.py @@ -307,7 +307,7 @@ def __Login(host, port, user, pwd, service, adapter, version, path, content = si.RetrieveContent() except vmodl.MethodFault: raise - except Exception, e: + except Exception as e: # NOTE (hartsock): preserve the traceback for diagnostics # pulling and preserving the traceback makes diagnosing connection # failures easier since the fault will also include where inside the diff --git a/pyVmomi/SoapAdapter.py b/pyVmomi/SoapAdapter.py index 32c68e9..7ffeeb8 100644 --- a/pyVmomi/SoapAdapter.py +++ b/pyVmomi/SoapAdapter.py @@ -1513,7 +1513,7 @@ class SessionOrientedStub(StubAdapterBase): time.sleep(self.retryDelay) retriesLeft -= 1 continue - except Exception, e: + except Exception as e: if isinstance(e, self.SESSION_EXCEPTIONS): # Our session might've timed out, change our state and retry. self._SetStateUnauthenticated()