Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

jasonoh's avatar
jasonoh
Explorer | Level 3
9 years ago
Solved

Python API V2 Error: ValueError Timeout

Hello,

 

I'm trying to use the Python API (v 8.5.0) from Pythonista on iOS (latest, on iPad Pro), and when I try to invoke any commands on the dbx object returned from dropbox.Dropbox('TOKEN'), e.g. files_upload, I get the following error:

 

Traceback (most recent call last):
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/urllib3/util/timeout.py", line 125, in _validate_timeout
    float(value)
TypeError: float() argument must be a string or a number, not 'Timeout'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/mobile_blogger/mobile_blogger.py", line 235, in <module>
    main()
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/mobile_blogger/mobile_blogger.py", line 228, in main
    mb.sync_to_dropbox(results['filename'], results['draft'], file)
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/mobile_blogger/mobile_blogger.py", line 134, in sync_to_dropbox
    self._dbx.files_upload(output, full_path)
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/site-packages/dropbox/base.py", line 2076, in files_upload
    f,
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/site-packages/dropbox/dropbox.py", line 234, in request
    timeout=timeout)
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/site-packages/dropbox/dropbox.py", line 325, in request_json_string_with_retry
    timeout=timeout)
  File "/private/var/mobile/Containers/Shared/AppGroup/E4C7B551-D492-40EB-A6E8-D6FA77EB9421/Pythonista3/Documents/site-packages/dropbox/dropbox.py", line 409, in request_json_string
    timeout=timeout,
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/requests/sessions.py", line 512, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/requests/sessions.py", line 469, in request
    resp = self.send(prep, **send_kwargs)
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/requests/sessions.py", line 577, in send
    r = adapter.send(request, **kwargs)
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/requests/adapters.py", line 377, in send
    timeout=timeout
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/urllib3/connectionpool.py", line 547, in urlopen
    timeout_obj = self._get_timeout(timeout)
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/urllib3/connectionpool.py", line 303, in _get_timeout
    return Timeout.from_float(timeout)
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/urllib3/util/timeout.py", line 155, in from_float
    return Timeout(read=timeout, connect=timeout)
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/urllib3/util/timeout.py", line 98, in __init__
    self._connect = self._validate_timeout(connect, 'connect')
  File "/var/containers/Bundle/Application/5EF5E379-FBDE-4C83-BE7B-D5D77464A370/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/urllib3/util/timeout.py", line 128, in _validate_timeout
    "int or float." % (name, value))
ValueError: Timeout value connect was Timeout(connect=30, read=30, total=None), but it must be an int or float.

 

I'm using the requests library (2.18.4), so it's not that... Running the same calls from desktop doesn't produce the above error.

 

Any insight would be greatly appreciated!

  • This error is based on the interaction between certain versions of both requests and urllib3. I recommend uninstalling both and reinstalling requests and its dependencies in order to get compatible versions.

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    This error is based on the interaction between certain versions of both requests and urllib3. I recommend uninstalling both and reinstalling requests and its dependencies in order to get compatible versions.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!