Move to python3 style except.

This commit is contained in:
Ahmed Charles 2015-10-18 21:45:54 +00:00 committed by Griatch
parent 0493dc0b4e
commit 0384fcc63d
24 changed files with 47 additions and 47 deletions

View file

@ -212,7 +212,7 @@ class SshProtocol(Manhole, session.Session):
"""
try:
text = utils.to_str(text if text else "", encoding=self.encoding)
except Exception, e:
except Exception as e:
self.lineSend(str(e))
return
raw = kwargs.get("raw", False)
@ -382,7 +382,7 @@ def makeFactory(configdict):
publicKey, privateKey = getKeyPair(pubkeyfile, privkeyfile)
factory.publicKeys = {'ssh-rsa': publicKey}
factory.privateKeys = {'ssh-rsa': privateKey}
except Exception, e:
except Exception as e:
print " getKeyPair error: %(e)s\n WARNING: Evennia could not auto-generate SSH keypair. Using conch default keys instead." % {'e': e}
print " If this error persists, create game/%(pub)s and game/%(priv)s yourself using third-party tools." % {'pub': pubkeyfile, 'priv': privkeyfile}

View file

@ -44,7 +44,7 @@ def verify_SSL_key_and_cert(keyfile, certfile):
rsaKey = Key(RSA.generate(KEY_LENGTH))
keyString = rsaKey.toString(type="OPENSSH")
file(keyfile, 'w+b').write(keyString)
except Exception, e:
except Exception as e:
print "rsaKey error: %(e)s\n WARNING: Evennia could not auto-generate SSL private key." % {'e': e}
print "If this error persists, create game/%(keyfile)s yourself using third-party tools." % {'keyfile': keyfile}
sys.exit(5)
@ -58,7 +58,7 @@ def verify_SSL_key_and_cert(keyfile, certfile):
try:
#, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
subprocess.call(exestring)
except OSError, e:
except OSError as e:
string = "\n".join([
" %s\n" % e,
" Evennia's SSL context factory could not automatically",

View file

@ -172,12 +172,12 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
else:
self.iaw_mode = False
return
except Exception, err1:
except Exception as err1:
conv = ""
try:
for b in data:
conv += " " + repr(ord(b))
except Exception, err2:
except Exception as err2:
conv = str(err2) + ":", str(data)
out = "Telnet Error (%s): %s (%s)" % (err1, data, conv)
logger.log_trace(out)
@ -299,7 +299,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
try:
text = utils.to_str(text if text else "", encoding=self.encoding)
except Exception, e:
except Exception as e:
self.sendLine(str(e))
return
if "oob" in kwargs and "OOB" in self.protocol_flags:

View file

@ -172,7 +172,7 @@ class WebSocketClient(Protocol, Session):
"""
try:
text = to_str(text if text else "", encoding=self.encoding)
except Exception, e:
except Exception as e:
self.sendLine(str(e))
if "oob" in kwargs:
for cmdname, args, okwargs in kwargs["oob"]: