def do_work(username): print username try: print "processing:", username User.similar_documents(username) print "success!" return ('success', username) except Exception as err: print "failed" return ('failure', username, err)
def main(fname): full_name = os.path.join('scraper/split_user_files', fname) print full_name success, failure = [], [] with open(full_name, 'rb') as f: for line in f: username = line.strip().lower() print "SCRAPING OUR FRIEND:",username try: User.similar_documents(username) except Exception as err: print err failure.append(username) print "DONE WITH:", username success.append(username) print "SUCCESS:", success print "FAILURE:", failure