Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: float() argument must be a string or a number, not 'Timeout' for python3.6 #114

Closed
yufeiluo opened this issue Jun 29, 2017 · 12 comments

Comments

@yufeiluo
Copy link

yufeiluo commented Jun 29, 2017

$ git clone git://github.com/dropbox/dropbox-sdk-python.git
$ cd dropbox-sdk-python
$ python setup.py install
>>> import dropbox
>>> dbx = dropbox.Dropbox("YOUR_ACCESS_TOKEN")
>>> dbx.users_get_current_account()
Traceback (most recent call last):
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/urllib3-1.21.1-py3.6.egg/urllib3/util/timeout.py", line 124, 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 "<stdin>", line 1, in <module>
  File "/home/debian8/dropbox-sdk-python/dropbox/base.py", line 3277, in users_get_current_account
    None,
  File "/home/debian8/dropbox-sdk-python/dropbox/dropbox.py", line 234, in request
    timeout=timeout)
  File "/home/debian8/dropbox-sdk-python/dropbox/dropbox.py", line 325, in request_json_string_with_retry
    timeout=timeout)
  File "/home/debian8/dropbox-sdk-python/dropbox/dropbox.py", line 409, in request_json_string
    timeout=timeout,
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 565, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 518, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 639, in send
    r = adapter.send(request, **kwargs)
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 438, in send
    timeout=timeout
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/urllib3-1.21.1-py3.6.egg/urllib3/connectionpool.py", line 587, in urlopen
    timeout_obj = self._get_timeout(timeout)
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/urllib3-1.21.1-py3.6.egg/urllib3/connectionpool.py", line 302, in _get_timeout
    return Timeout.from_float(timeout)
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/urllib3-1.21.1-py3.6.egg/urllib3/util/timeout.py", line 154, in from_float
    return Timeout(read=timeout, connect=timeout)
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/urllib3-1.21.1-py3.6.egg/urllib3/util/timeout.py", line 94, in __init__
    self._connect = self._validate_timeout(connect, 'connect')
  File "/home/debian8/anaconda3/lib/python3.6/site-packages/urllib3-1.21.1-py3.6.egg/urllib3/util/timeout.py", line 127, in _validate_timeout
    "int, float or None." % (name, value))
ValueError: Timeout value connect was Timeout(connect=30, read=30, total=None), but it must be an int, float or None.

@greg-db
Copy link
Contributor

greg-db commented Jun 30, 2017

[Cross-linking for reference: https://stackoverflow.com/questions/44836616/timeout-error-fo-dropbox-api-v2-with-python3-6 ]

This looks like a duplicate of #106. Can you check what version of requests is installed?

@yufeiluo
Copy link
Author

yufeiluo commented Jul 1, 2017

dropbox.Dropbox._API_VERSION
'2'
pip list |grep request
requests (2.14.2)

@yufeiluo
Copy link
Author

yufeiluo commented Jul 1, 2017

sudo /usr/bin/pip3.6 install -Iv requests==2.15.1
To test in python3.6,same timeout error.
sudo /usr/bin/pip3.6 uninstall requests
sudo /usr/bin/pip3.6 install -Iv requests==2.16.1
To test in python3.6,same timeout error.
sudo /usr/bin/pip3.6 uninstall requests
sudo /usr/bin/pip3.6 install -Iv requests==2.17.1
To test in python3.6,same timeout error.

????

@dennissiemensma
Copy link
Contributor

I'm experiencing the same for calling dbx.files_upload(). And calling the same method of this ticket's reporter (dbx.users_get_current_account()) breaks it here as well.

Dropbox client version is 8.0.0, the previous I was running (7.3.1) was working fine.

Python 3.5.2

requests==2.13.0
dropbox==8.0.0

@greg-db
Copy link
Contributor

greg-db commented Jul 3, 2017

@yufeiluo Apologies, you may actually have to go up to requests v2.18.1. Please try that out.

@dennissiemensma Likewise, please update to requests v2.18.1.

@dennissiemensma
Copy link
Contributor

Thanks, it fixes the problem here! Shouldn't the pip install install this dependency automatically btw?

@greg-db
Copy link
Contributor

greg-db commented Jul 3, 2017

@dennissiemensma Thanks for confirming that. And yes, it should. The dependency is listed here. I just tried it, and it did install requests v2.18.1 automatically for me when I ran pip install dropbox. If that didn't work for you, can you share your pip output, if you still have it?

@dennissiemensma
Copy link
Contributor

I see, but I mean.... if 2.18.x fixes the issue, shouldn't be the minimum version be that, instead of 2.5.x (as listed in the setup.py)?
I have added requests==2.18.1 in my own requirements.txt now, so it's fine for me anyway. Just wondering :].

Thanks again for the help, as I can now distribute the update for the dropbox-client v8 for my project.

@greg-db
Copy link
Contributor

greg-db commented Jul 3, 2017

I see, thanks for clarifying. Yes, we should probably just raise the requirement in general, since there were several bad requests versions. I'll ask the team to do so. Thanks!

@posita posita changed the title TypeError: float() argument must be a string or a number, not 'Timeout' fot pythoin3.6 TypeError: float() argument must be a string or a number, not 'Timeout' for python3.6 Jul 12, 2017
anishathalye added a commit to anishathalye/git-remote-dropbox that referenced this issue Aug 24, 2017
The Dropbox PyPI package does not specify the correct requests version
as a dependency. This patch works around the issue by raising the
minimum requests version required. See
dropbox/dropbox-sdk-python#114 for more
details.
@padremayi
Copy link

python: 3.5.2
requests: 2.18.4
dropbox: 8.0.0

The problem is still present

@greg-db
Copy link
Contributor

greg-db commented Oct 11, 2017

We've updated the dependencies in v8.4.0.

@greg-db greg-db closed this as completed Oct 11, 2017
@andreacat
Copy link

andreacat commented Apr 14, 2018

python: 3.6.1
urllib3: 1.22
requests: 2.18.4
dropbox: 8.7.1

The problem is still present, whether I install urllib3 or not

EDIT: in my case the problem has been solved by upgrading Python from 3.6.1 to 3.6.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants