示例#1
0
def io_exception(obj_id):
	global workingids
        fbauth.check_auth()
        print "An error occured. If it's a not an authentication error, please check your IDs and connection!"
        cm.empty_file("%s/IDs.txt"%cm.resume_dir)
        resume_ids_obj=open("%s/IDs.txt"%cm.resume_dir,'a') 
        for bak in workingids:
                resume_ids_obj.write("%s\n"%bak)
        resume_ids_obj.close()
        print "Current progress has been saved; restart the program to resume."
        cm.exexc(str(sys.exc_info()[0]),None)
示例#2
0
def smart_edit(filen):
    global active_file_obj
    try:
        if cm.active_dir == cm.resume_dir:
            print "Appending remaining data to file..."
            active_file_obj=open(filen,'a')
        else:
            print "Writing data to file..."
            active_file_obj=open(filen,'w')
    except:
        cm.exexc("the file seems to be in use","try again")
	smart_edit(filen)
示例#3
0
def check_auth():
    global access_token
    global graph
    try:
        graph=facebook.GraphAPI(access_token)
        info=graph.get_object("me")
        ret=info["name"]
        return ret
    except facebook.GraphAPIError:
        print "The access token seems to be invalid or expired."
        ret=change_access_token()
        return ret
    except:
        cm.exexc("could not connect to server","try again")
        check_auth()