Skip to content

Commit

Permalink
python3: 2to3 tool
Browse files Browse the repository at this point in the history
Fixes for Python 3 with 2to3

partial vmware#55
  • Loading branch information
higebu authored and hartsock committed Jul 28, 2014
1 parent a8c1be6 commit 170ea1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pyVim/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def Connect(host='localhost', port=443, user='root', pwd='',
host = info.group(1)[1:-1]
if info.group(2) is not None:
port = int(info.group(2)[1:])
except ValueError, ve:
except ValueError as ve:
pass

if namespace:
Expand Down Expand Up @@ -251,7 +251,7 @@ def Disconnect(si):
def GetLocalTicket(si, user):
try:
sessionManager = si.content.sessionManager
except Exception, e:
except Exception as e:
if type(e).__name__ == 'ExpatError':
msg = 'Malformed response while querying for local ticket: "%s"' % e
raise vim.fault.HostConnectFault(msg=msg)
Expand Down Expand Up @@ -329,7 +329,7 @@ def __Login(host, port, user, pwd, service, adapter, version, path,
x = content.sessionManager.Login(user, pwd, None)
except vim.fault.InvalidLogin:
raise
except Exception, e:
except Exception as e:
raise
return si, stub

Expand All @@ -345,7 +345,7 @@ def __Logout(si):
if si:
content = si.RetrieveContent()
content.sessionManager.Logout()
except Exception, e:
except Exception as e:
pass


Expand Down Expand Up @@ -465,7 +465,7 @@ def __VersionIsSupported(desiredVersion, serviceVersionDescription):
root = serviceVersionDescription
if root.tag == 'namespaces':
# serviceVersionDescription appears to be a vimServiceVersions.xml document
if root.get('version') <> '1.0':
if root.get('version') != '1.0':
raise RuntimeError('vimServiceVersions.xml has version %s,' \
' which is not understood' % (root.get('version')))
desiredVersionId = versionIdMap[desiredVersion]
Expand Down
4 changes: 2 additions & 2 deletions pyVmomi/DynamicTypeManagerHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def GetTypeManager(self):
if self.hostSystem:
try:
dynTypeMgr = self.hostSystem.RetrieveDynamicTypeManager()
except vmodl.fault.MethodNotFound, err:
except vmodl.fault.MethodNotFound as err:
pass

if not dynTypeMgr:
Expand Down Expand Up @@ -139,7 +139,7 @@ def _CreateAllTypes(self, enumTypes, dataTypes, managedTypes):
for typeInfo in infos:
try:
fn(*typeInfo)
except Exception, err:
except Exception as err:
#Ignore errors due to duplicate importing
pass

Expand Down
2 changes: 1 addition & 1 deletion pyVmomi/Iso8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def ParseISO8601(datetimeStr):
datetimeVal = datetime(**dt)
if delta:
datetimeVal += delta
except Exception, e:
except Exception as e:
pass
return datetimeVal

Expand Down

0 comments on commit 170ea1d

Please sign in to comment.