class Downloader(threading.Thread): def __init__(self, queue): threading.Thread.__init__(self) self.q = queue self.logger = logging.getLogger('Pindel') self.srm = SRMClient(self.logger) self.daemon = False def run(self): while not self.q.empty(): f = self.q.get() count = 0 done = False while(count < 10 and not done): try: self.srm.download(f) done = True except: count += 1 if(count > 9): raise EnvironmentError("Download failed.") self.q.task_done() print "Exeting while loop, thread should close itself..."
class Downloader(threading.Thread): def __init__(self, queue): threading.Thread.__init__(self) self.q = queue self.logger = logging.getLogger('Pindel') self.srm = SRMClient(self.logger) self.daemon = False def run(self): while not self.q.empty(): f = self.q.get() count = 0 done = False while (count < 10 and not done): try: self.srm.download(f) done = True except: count += 1 if (count > 9): raise EnvironmentError("Download failed.") self.q.task_done() print "Exeting while loop, thread should close itself..."
def __init__(self, queue): threading.Thread.__init__(self) self.q = queue self.logger = logging.getLogger('Pindel') self.srm = SRMClient(self.logger) self.daemon = False