如何修复pyrebase,“ firebase.storage”上传for循环中的迭代,Python中的错误

时间:2019-02-12 18:19:11

标签: python-3.x firebase firebase-authentication firebase-storage pyrebase

仅在上传到pyrebase firebase.storage时出现错误。我确实设法得到一个文件上传。但是,当我遍历照片循环时,会发生错误。 AttributeError:“ Firebase”对象没有属性“ put”

我有我正在研究“””消息的部分,“””。

我试图将身份验证从循环中移出,这使我与实时数据库的firebase.put连接出错。我还尝试在开始时在循环外执行pyrebase.initialize_app(config)和&storage = firebase.storage(),并且出现了更多错误。

我确实放了我的

for (a,b,c,d) in rect:
    # Crop ROI locations
    crop_empty = smallgray[a:b,c:d].copy()
    crop = small2gray[a:b,c:d].copy()
    var2 = np.var(crop_empty) #Dividing by threshold to other image
    var = np.var(crop) /3 # Percentage of difference
    finaldiff = var > var2
    if finaldiff == True:
        countTrues = countTrues + 1
        cv2.line(appMask,(c,a),(d,b),(0,0,0),5)
        cv2.imshow("AppMask_spots", appMask)
        #print ('True') 
    else:
        #print ('False')
        continue
Empty = Lot - countTrues
send_app_totals = ([Lot,countTrues,Empty]) #Array of quantities to 
    Firebase database https://test1-ecd49.firebaseio.com/
    #print(send_app_totals)       
    send_app = appMask
    cv2.imwrite('send_app.jpg',send_app)
    send_data = firebase.put('/Lot','I',send_app_totals) # Pass array over internet to Firebase

    """
    document = "send_app.jpg"  # Directory of your document
    # Connection data for Firebase
    config = {"apiKey": "xxxxxxxxxxxxxxxx",
        "authDomain": "xxxxxxxx.firebaseapp.com",
        "databaseURL": "https://xxxxxxx.firebaseio.com",
        "storageBucket": "xxxxxxx.appspot.com",
        "projectId": "xxxxxxxxx",
        "serviceAccount": "xxxxxxxxxxx.json"}

    firebase = pyrebase.initialize_app(config) # Initialize the connection
    storage = firebase.storage() # Initialize the storage
    storage.child("branch/directory").put(document) # Upload file to storage in Firebase
    print("Upload complete...") # Confirmation 
    """

0 个答案:

没有答案