Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi I am currently in the process of migrating my code to use v2 and am hitting an error when trying to upload in python.
Error:
stone_serializers.py", line 887, in _make_stone_friendly
raise bv.ValidationError(e.args[0])
ValidationError: client_modified: attribute of type 'NoneType' is not callable
I'm not sending a client mod time and not sure how to fix this.
I have to say v2 is much more complicated than v1 and feel the docs could use a lot of examples in them.
Any help would be appreciated.
Hi,
Python 2.7
Thanks.
We could use a bit more information. Can you run the following and share the output? Thanks in advance!
python -c 'import dropbox;print dropbox.__version__;print dropbox.__package__;print dropbox.__file__'
Hi,
Here you go.
8.2.0
dropbox
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dropbox-8.2.0-py2.7.egg/dropbox/__init__.pyc
and here it is from the kodi module i made
8.2.0
dropbox
/Users/John/Library/Application Support/Kodi/addons/script.module.dropbox2/lib/dropbox/__init__.pyo
Ok after some investigating I have noticed the first attempt gives no errors, all subsequent attempts give the client modified nonetype error.
After some googling I finally came accross some info that this is a known issue with datetime in python.
I found this:
try: datetime.strptime(date_string, format) except TypeError: datetime(*(time.strptime(date_string, format)[0:6]))
So I decided to manually tweak the make stone friendly function in the api to this.
def _make_stone_friendly( data_type, val, alias_validators, strict, validate, for_msgpack): """ Convert a Python object to a type that will pass validation by its validator. Validation by ``alias_validators`` is performed even if ``validate`` is false. """ if isinstance(data_type, bv.Timestamp): try: ret = datetime.datetime.strptime(val, data_type.format) except: print("datetime.datetime.strptime(val, data_type.format) returned NoneType. Trying alterntive") pass try: ret = datetime.datetime(*(time.strptime(val, data_type.format)[0:6])) except (TypeError, ValueError) as e: raise bv.ValidationError(e.args[0]) elif isinstance(data_type, bv.Bytes): if for_msgpack: if isinstance(val, six.text_type): ret = val.encode('utf-8') else: ret = val else: try: ret = base64.b64decode(val) except TypeError: raise bv.ValidationError('invalid base64-encoded bytes') elif isinstance(data_type, bv.Void): if strict and val is not None: raise bv.ValidationError("expected null, got value") return None else: if validate: data_type.validate(val) ret = val if alias_validators is not None and data_type in alias_validators: alias_validators[data_type](ret) return ret
I can say it is now working every time without error.
I'm sure you don't like the code being altered and I can totally understand that but if you think the code doesn't look like it will yeild any issues then I'm happy to do a pull request on github.
Hi there!
If you need more help you can view your support options (expected response time for a 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!