cleanup: Don't use "except Exception as e" syntax, which isn't valid in Python 2.4.

This commit is contained in:
Sam Edwards 2013-09-23 02:56:28 -06:00
parent e6d4c64f37
commit acae1bfc16
17 changed files with 27 additions and 27 deletions

View file

@ -335,7 +335,7 @@ class TimeManager(DistributedObject.DistributedObject):
bugfix,
major,
minor)
except Exception as e:
except Exception, e:
self.notify.debug('getMacOsInfo %s' % str(e))
self.notify.debug('getMacOsInfo returning %s' % str(result))

View file

@ -348,7 +348,7 @@ class OTPClientRepository(ClientRepositoryBase):
def gotoFirstScreen(self):
try:
self.accountServerConstants = AccountServerConstants.AccountServerConstants(self)
except TTAccount.TTAccountException as e:
except TTAccount.TTAccountException, e:
self.notify.debug(str(e))
self.loginFSM.request('failedToGetServerConstants', [e])
return
@ -1709,7 +1709,7 @@ class OTPClientRepository(ClientRepositoryBase):
def refreshAccountServerDate(self, forceRefresh = 0):
try:
self.accountServerDate.grabDate(force=forceRefresh)
except TTAccount.TTAccountException as e:
except TTAccount.TTAccountException, e:
self.notify.debug(str(e))
return 1

View file

@ -240,7 +240,7 @@ class LevelSpec:
backupFilename = self.privGetBackupFilename(filename)
self.privRemoveFile(backupFilename)
os.rename(filename, backupFilename)
except OSError as e:
except OSError, e:
LevelSpec.notify.warning('error during backup: %s' % str(e))
LevelSpec.notify.info("writing to '%s'" % filename)

View file

@ -158,7 +158,7 @@ class CreateAccountScreen(StateData.StateData, GuiScreen.GuiScreen):
if referrer is not None:
data['referrer'] = referrer
error = self.loginInterface.createAccount(self.userName, self.password, data)
except TTAccount.TTAccountException as e:
except TTAccount.TTAccountException, e:
error = str(e)
self.notify.info(error)
self.dialog.setMessage(error + OTPLocalizer.CreateAccountScreenConnectionErrorSuffix)

View file

@ -200,7 +200,7 @@ class LoginScreen(StateData.StateData, GuiScreen.GuiScreen):
self.cr.password = self.password
try:
error = self.loginInterface.authorize(self.userName, self.password)
except TTAccount.TTAccountException as e:
except TTAccount.TTAccountException, e:
self.fsm.request('showConnectionProblemDialog', [str(e)])
return

View file

@ -74,7 +74,7 @@ class LoginTTAccount(LoginBase.LoginBase, TTAccount.TTAccount):
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
elif self.useTTSpecificLogin:
@ -85,7 +85,7 @@ class LoginTTAccount(LoginBase.LoginBase, TTAccount.TTAccount):
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
else:
@ -101,7 +101,7 @@ class LoginTTAccount(LoginBase.LoginBase, TTAccount.TTAccount):
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
else:

View file

@ -22,7 +22,7 @@ class RemoteValueSet:
continue
try:
name, value = line.split('=', 1)
except ValueError as e:
except ValueError, e:
errMsg = 'unexpected response: %s' % response
self.notify.warning(errMsg)
onUnexpectedResponse(errMsg)

View file

@ -55,7 +55,7 @@ class TTAccount:
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
return None
@ -71,7 +71,7 @@ class TTAccount:
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
return None
@ -85,7 +85,7 @@ class TTAccount:
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
return None
@ -274,7 +274,7 @@ class TTAccount:
if self.response.getInt('errorCode') in (5, 72):
return (0, None)
return (0, errorMsg)
except TTAccountException as e:
except TTAccountException, e:
return (0, str(e))
return None

View file

@ -439,7 +439,7 @@ def decodeCatalogItem(di, versionNumber, store):
code = di.getUint8()
itemClass = CatalogReverseType[typeIndex]
item = itemClass(di, versionNumber, store=store)
except Exception as e:
except Exception, e:
CatalogItem.notify.warning('Invalid catalog item in stream: %s, %s' % (sys.exc_info()[0], e))
d = Datagram(di.getDatagram().getMessage()[startIndex:])
d.dumpHex(Notify.out())
@ -459,7 +459,7 @@ def getItem(blob, store = 0):
try:
versionNumber = di.getUint8()
return decodeCatalogItem(di, versionNumber, store)
except Exception as e:
except Exception, e:
CatalogItem.notify.warning('Invalid catalog item: %s, %s' % (sys.exc_info()[0], e))
dg.dumpHex(Notify.out())
import CatalogInvalidItem

View file

@ -152,7 +152,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
toon = Toon.Toon()
try:
toon.setDNA(dna)
except Exception as e:
except Exception, e:
print e
return

View file

@ -37,7 +37,7 @@ class EffectController:
if lod != None:
try:
self.createTrack(lod)
except TypeError as e:
except TypeError, e:
raise TypeError('Error loading %s effect.' % self.__class__.__name__)
else:
@ -74,7 +74,7 @@ class EffectController:
if lod != None:
try:
self.createTrack(lod)
except TypeError as e:
except TypeError, e:
raise TypeError('Error loading %s effect.' % self.__class__.__name__)
else:

View file

@ -86,7 +86,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
self.visId = visId
self.hoodId = ZoneUtil.getCanonicalHoodId(visId)
self.notify.debug('calcHoodId %d from %s' % (self.hoodId, fullString))
except Exception as generic:
except Exception, generic:
if 'Editor' not in fullString:
self.notify.warning("calcHoodId couldn't parse %s using 0" % fullString)
self.hoodId = 0

View file

@ -497,7 +497,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM):
baseAnimName = animName.split('/')[-1]
if localAvatar.zoneId == self.visId:
self.notify.info('playing %s' % baseAnimName)
except Exception as e:
except Exception, e:
self.notify.warning('Unknown error in printAnimIfClose, giving up:\n%s' % str(e))
def clearCurIval(self):

View file

@ -31,7 +31,7 @@ class AccountServerDate:
raise UnexpectedResponse, 'unexpected response, response=%s' % response
try:
epoch = int(response[1])
except ValueError as e:
except ValueError, e:
self.notify.debug(str(e))
raise UnexpectedResponse, 'unexpected response, response=%s' % response

View file

@ -223,7 +223,7 @@ class PartyCogActivity(DirectObject):
if ival is not None and ival.isPlaying():
try:
ival.finish()
except Exception as theException:
except Exception, theException:
self.notify.warning('Ival could not finish:\n %s \nException %s ' % (str(ival), str(theException)))
self.toonPieTracks = {}
@ -231,7 +231,7 @@ class PartyCogActivity(DirectObject):
if ival is not None and ival.isPlaying():
try:
ival.finish()
except Exception as theException:
except Exception, theException:
self.notify.warning('Ival could not finish:\n %s \nException %s ' % (str(ival), str(theException)))
self.pieIvals = []

View file

@ -468,14 +468,14 @@ class DistributedPet(DistributedSmoothNode.DistributedSmoothNode, Pet.Pet, PetBa
try:
self.movieTrack = Sequence(Func(self._petMovieStart, av), Parallel(av.getCallPetIval(), Sequence(Wait(0.54), SoundInterval(self.callSfx))), self._getPetMovieCompleteIval(av))
self.movieTrack.start()
except StandardError as error:
except StandardError, error:
print str(error)
if mode == PetConstants.PET_MOVIE_SCRATCH:
try:
self.movieTrack = Sequence(Func(self._petMovieStart, av), Func(self.holdPetDownForMovie), Parallel(self.getInteractIval(self.Interactions.SCRATCH), av.getScratchPetIval(), SoundInterval(self.petSfx)), Func(self.releasePetFromHoldDown), self._getPetMovieCompleteIval(av))
self.movieTrack.start()
except StandardError as error:
except StandardError, error:
print str(error)
if mode == PetConstants.PET_MOVIE_FEED:

View file

@ -354,7 +354,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
cacheIndexFilename = Filename(self.newsDir, self.CacheIndexFilename)
try:
file = open(cacheIndexFilename.toOsSpecific(), 'w')
except IOError as e:
except IOError, e:
self.notify.warning('error opening news cache file %s: %s' % (cacheIndexFilename, str(e)))
return