You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

delta1071's avatar
delta1071
Explorer | Level 4
6 years ago

Python 3.5 API upload error

I'm using a Raspberry Pi 3 B+ with the a Pi Camera to record surveillance images and occasionally upload them to my Dropbox account. The Python script runs until it's time to upload the images to Dropbox and then this error occurs:

[UPLOAD] Wednesday 12 December 2018 07:43:50AM
Traceback (most recent call last):
File "pi_surveillance.py", line 126, in <module>
client.files_upload(open(t.path, "rb").read(), path)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/dropbox/base.py", line 2187, in files_upload
f,
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/dropbox/dropbox.py", line 296, in request
user_message_locale)
dropbox.exceptions.ApiError: ApiError('88dea4768f5b9c6b5cfc7e05ce25133d', UploadError('path', UploadWriteFailed

I was previously receiving a "malformed token" error, but it has since been replaced with this new error. Can anyone steer me in the right direction. Any help is greatly appreciated.

 

Regards,

delta1071

 

 

  • Greg-DB's avatar
    Greg-DB
    6 years ago

    Thanks! I see you're referencing a Dropbox web site URL in your path. When identifying files by path on the Dropbox API, you should not use Dropbox web site URLs like this.

    You only need to write them relative to "root", so e.g., you might use a value like "/Pi Image Search/123.jpg", to upload a file into a folder named "Pi Image Search", or just "/123.jpg" to upload a file into whatever root your app has.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    It looks like the output you shared here is cut off. There should be more after "UploadWriteFailed". Can you share the rest of that so we can take a look? Thanks in advance! 

    • delta1071's avatar
      delta1071
      Explorer | Level 4

      Sorry Greg, didn't notice that. Here's the entire error message:

      [UPLOAD] Thursday 13 December 2018 03:13:03PM
      Traceback (most recent call last):
      File "pi_surveillance.py", line 126, in <module>
      client.files_upload(open(t.path, "rb").read(), path)
      File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/dropbox/base.py", line 2187, in files_upload
      f,
      File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/dropbox/dropbox.py", line 296, in request
      user_message_locale)
      dropbox.exceptions.ApiError: ApiError('b61692b65ac6c9567e93b708e5b09354', UploadError('path', UploadWriteFailed(reason=WriteError('malformed_path', None), upload_session_id='AAAAAAAAAFpRjEudLSydjw')))

      Thanks,  

      delta1071

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks! I see you're getting a 'malformed_path' error. That should indicate that the path you're giving for the upload isn't in a valid format. What value are you supplying as the 'path' parameter (i.e., the second parameter on files_upload)?

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 2 days ago
194 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!