Use newer form of catching exceptions

autopep8 -i --select=W602
Also some other minor deprecated syntax changes, like "while 1".
I did not commit the less obvious changes.
This commit is contained in:
Laurent Bachelier 2013-07-27 15:13:48 +02:00
commit a6ad7e83ff
72 changed files with 151 additions and 154 deletions

View file

@ -131,7 +131,7 @@ class PriorityConnection(Optimization):
zipcode= 75001,
country= 'fr',
godfather= my_id)
except AccountRegisterError, e:
except AccountRegisterError as e:
self.logger.warning('Unable to register account: %s' % e)
except CaptchaError:
self.logger.warning('Unable to solve captcha... Retrying')
@ -156,12 +156,12 @@ class PriorityConnection(Optimization):
fakes = self.storage.get('priority_connection', 'fakes', default={})
if len(fakes) == 0:
return
while 1:
while True:
name = random.choice(fakes.keys())
fake = fakes[name]
try:
browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy)
except (AdopteBanned,BrowserIncorrectPassword), e:
except (AdopteBanned,BrowserIncorrectPassword) as e:
self.logger.warning('Fake %s can\'t login: %s' % (name, e))
continue

View file

@ -97,7 +97,7 @@ class ProfilesWalker(Optimization):
# We consider this profil hasn't been [correctly] analysed
self.profiles_queue.add(id)
return
except Exception, e:
except Exception as e:
print e
finally:
if self.view_cron is not None:

View file

@ -47,6 +47,6 @@ class Visibility(Optimization):
try:
with self.browser:
self.browser.login()
except BrowserUnavailable, e:
except BrowserUnavailable as e:
print str(e)
pass