print('Could not complete for %s' % item.rstrip()) pass except Exception as e: for exection in e: print e # print('Could not complete error grave for %s' %item.rstrip()) # pass with Controller.from_port(port=9151) as controller: controller.authenticate() f = open('torlist.txt') for line in f: try: pool.apply_async(worker, (line, )) except Exception: print('Could not complete error grave') pass f.close() #for item in range(100): # pool.apply_async(worker, (item,)) pool.close() pool.join(10) if pool.is_alive(): print "running... let's kill it..." # Terminate pool.terminate() pool.join() print a