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:
parent
fb1b8bc5b8
commit
a6ad7e83ff
72 changed files with 151 additions and 154 deletions
|
|
@ -301,7 +301,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
|||
children=[],
|
||||
flags=Message.IS_UNREAD)
|
||||
yield thread.root
|
||||
except BrowserUnavailable, e:
|
||||
except BrowserUnavailable as e:
|
||||
self.logger.debug('No messages, browser is unavailable: %s' % e)
|
||||
pass # don't care about waiting
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ class Decoder(object):
|
|||
|
||||
def main(self):
|
||||
try:
|
||||
while 1:
|
||||
while True:
|
||||
self.process()
|
||||
except KeyboardInterrupt:
|
||||
print ''
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue