3

I am currently doing a motion detection program. I have already managed to capture images when motion is detected. I want the photos to be uploaded to Dropbox when captured. It works fine for the first few images but stops working after awhile. It displays the following error

ApiError: ApiError('', UploadError(u'path', UploadWriteFailed(reason=WriteError(u'conflict', WriteConflictError(u'file', None)), upload_session_id=u'')))

This is my code

def TakePicUpload(avg):

1 Answer 1

7

You're getting a file WriteConflictError:

https://dropbox-sdk-python.readthedocs.io/en/latest/api/files.html?highlight=writeconflicterror#dropbox.files.WriteConflictError

That's documented as:

There’s a file in the way.

So, that just means there's already at the path (savetolocation in your case) where you're trying to upload.

You can either remove that file if you don't want it, or specify a different write mode when calling files_upload:

https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html?highlight=files_upload#dropbox.dropbox.Dropbox.files_upload

More specifically you can add mode=dropbox.files.WriteMode.overwrite as a parameter to files_upload method.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks man now it works but it is super laggy when it starts to capture image when motion is detected. Do you have any idea how to reduce the lag @Greg
@Aplin It sounds like that's occurring before the Dropbox step, so I'm afraid that's outside my area of expertise. Apologies I can't be of more help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.