Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Upgrade exception handling to Python3 #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import os
env = Environment(ENV = os.environ)
try:
env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')])
except Exception, e:
raise Exception, 'CBANG_HOME not set?\n' + str(e)
except Exception as e:
raise Exception('CBANG_HOME not set?\n' + str(e))

env.CBLoadTools('packager run_distutils osx fah-client-version')
env.CBAddVariables(
Expand All @@ -14,7 +14,7 @@ conf = env.CBConfigure()
# Version
try:
version = env.FAHClientVersion()
except Exception, e:
except Exception as e:
print(e)
version = '0.0.0'
env.Replace(PACKAGE_VERSION = version)
Expand Down
12 changes: 6 additions & 6 deletions fah/Connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ def read_some(self):
self.connection_lost()
return 0

except socket.error as (err, msg):
except socket.error as err:
# Error codes for nothing to read
if err not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
if err.errno not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
if bytesRead: return bytesRead
self.connection_error(err, msg)
self.connection_error(err, err.strerror)
raise

return bytesRead
Expand All @@ -178,11 +178,11 @@ def write_some(self):
self.connection_lost()
return 0

except socket.error as (err, msg):
except socket.error as err:
# Error codes for write buffer full
if err not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
if err.errno not in [errno.EAGAIN, errno.EWOULDBLOCK, WSAEWOULDBLOCK]:
if bytesWritten: return bytesWritten
self.connection_error(err, msg)
self.connection_error(err, err.strerror)
raise

return bytesWritten
Expand Down
4 changes: 2 additions & 2 deletions fah/FAHControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,9 +1058,9 @@ def save_client_config(self, client):

return True

except Exception, msg:
except Exception as err:
self.set_status('Save Failed')
self.error(msg)
self.error(err)
return False


Expand Down