def run(self):
        api = self.api
    
        while True:
            task = self.queue.get()
            try:
                # Check to see if we've hit the rate limit.
                limit_status = api.account.rate_limit_status()

                if (limit_status.remaining_hits < 2):
                  time_to_wait = limit_status.reset_time_in_seconds - time.time()

                  print "Rate limit hit on a thread, waiting  %i minutes..." % int(60/time_to_wait)
                  self.stopped.wait(time_to_wait + 10)
        
                task.run(self.api, self.screen_name)

                self.completionManager.done(task)
                self.queue.task_done()

            except Exception as e:
                print "Error on thread for user %s" % self.screen_name
                print e

                # Skip tasks with "Not authorized" errors and never try again
                if e.message == "Not authorized":
                  self.completionManager.done(task)
                  print "------- Will not try tasks which gave this type of error ever again"
dataset/ETHPy150Open domrout/python-twitter-wrapper/twitterutils/twitter_worker.py/TwitterWorker.run/swapped operands of `/`