作者:xkxk22 | 来源:互联网 | 2023-09-25 10:17
ImattemptingtouploadatextfiletoDropboxusingthiscode:我正在尝试使用以下代码将文本文件上传到Dropbox:defup
I'm attempting to upload a text file to Dropbox using this code:
我正在尝试使用以下代码将文本文件上传到Dropbox:
def uploadFile(file):
f = open('logs/%s.txt' % file)
respOnse= client.put_file('/%s.txt' % file, f)
print "Uploaded log file %s" % file
Connecting to dropbox works perfectly fine, it's just when I upload files I recieve this error:
连接到Dropbox工作得非常好,就在我上传文件时我收到了这个错误:
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\dropbox_python_sdk-1.5.1-py2.7.egg\dropbox
\client.py", line 352, in put_file
return self.rest_client.PUT(url, file_obj, headers)
File "C:\Python27\lib\site-packages\dropbox_python_sdk-1.5.1-py2.7.egg\dropbox
\rest.py", line 265, in PUT
return cls.IMPL.PUT(*n, **kw)
File "C:\Python27\lib\site-packages\dropbox_python_sdk-1.5.1-py2.7.egg\dropbox
\rest.py", line 211, in PUT
return self.request("PUT", url, body=body, headers=headers, raw_respOnse=raw
_response)
File "C:\Python27\lib\site-packages\dropbox_python_sdk-1.5.1-py2.7.egg\dropbox
\rest.py", line 174, in request
raise util.AnalyzeFileObjBug(clen, bytes_read)
dropbox.util.AnalyzeFileObjBug:
Expected file object to have 18 bytes, instead we read 17 bytes.
File size detection may have failed (see dropbox.util.AnalyzeFileObj)
Google has given me no help with this one.
谷歌没有给我任何帮助。
1 个解决方案