cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python SDK constant errors

Python SDK constant errors

RCR
Explorer | Level 3
Go to solution

Trying to make a small app that will read a pair of files from a dropbox folder and compile a small database from them. Just getting started, following the sample but I keep getting errors of different kinds.

I'm using virtualenv and have only installed dropbox and its dependencies using 

 

pip install dropbox

 

This is my pip freeze:

 

appdirs==1.4.3
certifi==2017.4.17
chardet==3.0.3
dropbox==7.3.1
idna==2.5
packaging==16.8
pyparsing==2.2.0
requests==2.16.5
six==1.10.0
urllib3==1.21.1

 

Trying to run the files_list_folder example, I first had an issue that any folder name would not pass some regex validation. Even a name as simple as 'testFolder' would fail.

Traceback (most recent call last):
  File "process-dropbox.py", line 7, in <module>
    for entry in dbx.files_list_folder('testFolder').entries:
  File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/base.py", line 710, in files_list_folder
    include_has_explicit_shared_members)
  File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/files.py", line 3180, in __init__
    self.path = path
  File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/files.py", line 3204, in path
    val = self._path_validator.validate(val)
  File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/stone_validators.py", line 316, in validate
    % (val, self.pattern))
dropbox.stone_validators.ValidationError: ‘testFolder’ did not match pattern '(/(.|[\r\n])*)?|(ns:[0-9]+(/.*)?)'

 

 

I decided to try an empty name (supposedly for the root directory) and that seems to pass the validation, but then it throws this error.

Traceback (most recent call last):
File "process-dropbox.py", line 5, in <module>
dbx.users_get_current_account()
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/base.py", line 3277, in users_get_current_account
None,
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/dropbox.py", line 239, in request
timeout=timeout)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/dropbox.py", line 330, in request_json_string_with_retry
timeout=timeout)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/dropbox/dropbox.py", line 414, in request_json_string
timeout=timeout,
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/requests/sessions.py", line 570, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/requests/sessions.py", line 523, in request
resp = self.send(prep, **send_kwargs)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/urllib3/connectionpool.py", line 587, in urlopen
timeout_obj = self._get_timeout(timeout)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/urllib3/connectionpool.py", line 302, in _get_timeout
return Timeout.from_float(timeout)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/urllib3/util/timeout.py", line 154, in from_float
return Timeout(read=timeout, connect=timeout)
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/urllib3/util/timeout.py", line 94, in __init__
self._connect = self._validate_timeout(connect, 'connect')
File ".../dbdata/backend/tests/dropbox/app-dropbox/lib/python2.7/site-packages/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.

 


I also tried users_get_current_account and got the same error.

Not sure where to go from here. This feels like the dependencies are perhaps not the right versions or something. I am not sure where to go from here.

Thanks in advance for any help.

13 Replies 13

Greg-DB
Dropbox Staff
Go to solution
The app folder name setting would be used when setting the name of new app folders when more users link to your app. Changing it won't change the name of existing app folders though.

scps950707
Explorer | Level 4
Go to solution

Same problem still meet after upgrading requests to 2.18.1

>>> import dropbox
>>> dbx = dropbox.Dropbox(' my token')
>>> dbx.users_get_current_account()

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/scps950707/.local/lib/python2.7/site-packages/dropbox/base.py", line 3277, in users_get_current_account
None,
File "/home/scps950707/.local/lib/python2.7/site-packages/dropbox/dropbox.py", line 239, in request
timeout=timeout)
File "/home/scps950707/.local/lib/python2.7/site-packages/dropbox/dropbox.py", line 330, in request_json_string_with_retry
timeout=timeout)
File "/home/scps950707/.local/lib/python2.7/site-packages/dropbox/dropbox.py", line 414, in request_json_string
timeout=timeout,
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/sessions.py", line 549, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 587, in urlopen
timeout_obj = self._get_timeout(timeout)
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 302, in _get_timeout
return Timeout.from_float(timeout)
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 154, in from_float
return Timeout(read=timeout, connect=timeout)
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 94, in __init__
self._connect = self._validate_timeout(connect, 'connect')
File "/home/scps950707/.local/lib/python2.7/site-packages/requests/packages/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.



adium-theme-ubuntu==0.3.4
backports.shutil-get-terminal-size==1.0.0
backports.shutil-which==3.5.1
beautifulsoup4==4.4.1
ccsm==0.9.12.2
certifi==2017.4.17
chardet==3.0.4
colorama==0.3.7
compizconfig-python==0.9.12.2
configparser==3.5.0
decorator==4.0.11
defer==1.0.6
Django==1.10.5
django-dbbackup==3.1.3
django-storages==1.6
dropbox==7.3.1
enum34==1.1.6
flake8==3.3.0
futures==3.0.5
html5lib==0.999
idna==2.5
iso-639==0.4.5
iso3166==0.8
lxml==3.5.0
mccabe==0.6.1
mysqlclient==1.3.10
pathlib2==2.2.1
psutil==5.1.3
pycodestyle==2.3.1
pycryptodome==3.4.5
pyflakes==1.5.0
Pygments==2.1
pygobject==3.20.0
python-apt==1.1.0b1
python-debian==0.1.27
pytz==2017.2
requests==2.18.1
scandir==1.4
singledispatch==3.4.0.3
six==1.10.0
streamlink==0.3.2
the**bleep**==3.14
typing==3.6.1
ubuntu-cleaner==1.0.4
unity-lens-photos==1.0
urllib3==1.21.1

 

getrt1991
New member | Level 2
Go to solution

I have the same problem. But I updated my requests to v2.18.4. 
when I run: 
 dbx.users_get_current_account()

 

It shows error message: 
  

ValueError: Timeout value connect was Timeout(connect=30, read=30, total=None), but it must be an int, float or None.

 

Greg-DB
Dropbox Staff
Go to solution

If you're still seeing ValueError, make sure you're on the latest version of the requests library, and double check that that latest version is actually getting used in the Python environment that you're running in.

 

Additionally, we received a report that this issue can persist if you're using Python 3.6.1, and that upgrading to 3.6.5 can fix that.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    getrt1991 New member | Level 2
  • User avatar
    scps950707 Explorer | Level 4
  • User avatar
    RCR Explorer | Level 3
What do Dropbox user levels mean?