本文介绍了使用Python将图片文件上传到Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经做了很多尝试,但是我无法弄清楚为什么我的代码中返回的对象imageBlob是NoneType? 请有人帮助我
I have tried so much but I'm unable to figure out why this the returned object imageBlob in my code is NoneType ? Please some body help me
我的代码是
import firebase from google.cloud import storage from google.cloud.storage import client import cv2 import firebase_admin from firebase_admin import credentials from firebase_admin import storage currentImage = None firebase = firebase.FirebaseApplication('auburnfirebase.firebaseio', None) imageUrl = "imageurlkalyan" firebase.delete('/image',None) result = firebase.post('/image',imageUrl) cred = credentials.Certificate('storageServiceAuburn.json') firebase_admin.initialize_app(cred, { 'storageBucket': 'auburnfirebase.appspot' }) bucket = storage.bucket() print bucket img = cv2.imread('photo.png') #cv2.imshow('image',img) imageBlob = bucket.get_blob('C:/Python27/photo.png') print imageBlob预先感谢
推荐答案是的!我明白了
imageBlob = bucket.blob(os.path.basename('C:/Python27/photo.png'))仅通过更改大量有效代码即可
only by changing this much of code it worked
更多推荐
使用Python将图片文件上传到Firebase
发布评论