我正试图通过直接将图像文件写入DropBox来减少我的SD卡上的读/写。我将图像捕获到流中,但我不知道如何将其写入Dropbox。这是覆盆子pi。
dbx = dropbox.Dropbox('token')
stream = io.BytesIO()
with picamera.PiCamera() as camera:
camera.resolution = (1280,960)
camera.capture(stream,format='jpeg')
stream.seek(0)
im = Image.open(stream)
dbx.files_upload(im,"/test.jpg",mute=True)
我收到以下错误,但不确定它的含义或如何修复它。
Traceback (most recent call last):
File "./camera.py", line 25, in <module>
dbx.files_upload(im,"/test.jpg",mute=True)
File "/usr/local/lib/python2.7/dist-packages/dropbox/base.py", line 1225, in files_upload
f,
File "/usr/local/lib/python2.7/dist-packages/dropbox/dropbox.py", line 249, in request
timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/dropbox/dropbox.py", line 341, in request_json_string_with_retry
timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/dropbox/dropbox.py", line 385, in request_json_string
type(request_binary))
TypeError: expected request_binary as binary type, got <type 'instance'>