Got an unexpected keyword argument 'timeout' (google-cloud-storage in Python)

Viewed 4647

A project in Python that uses google-cloud-storage works fine locally, but when it is running from App Engine it shows the error:

Traceback (most recent call last): 
File "/opt/python3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() 
File "/opt/python3.7/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs)  [...] 
File "/env/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 2107, in upload_from_string timeout=timeout,  
File "/env/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1921, in upload_from_file timeout=timeout,  
File "/env/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1769, in _do_upload timeout=timeout,  
File "/env/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1405, in _do_multipart_upload transport, data, object_metadata, content_type, timeout=timeout 
TypeError: transmit() got an unexpected keyword argument 'timeout'
3 Answers

Installing google-resumable-media==0.6 solved the problem. The version installed before was 0.7.

pip uninstall google-resumable-media
pip uninstall google-cloud-storage
pip install google-resumable-media==0.6.0
pip install google-cloud-storage==1.30.0

Downgrade google-cloud-storage to 1.30

pip uninstall google-cloud-storage
pip install google-cloud-storage==1.30.0

I was able to resolve this issue by uninstalling all my google cloud modules then reinstalling the latest versions by not specifying a version.

To uninstall pip freeze to get the list of google modules to uninstall (in my case I just deleted my virtualenv directory).

I then installed without a version to get the latest version. Your list may be different.

pip install google-auth
pip install google-cloud-core
pip install google-cloud-storage
pip install google-resumable-media
pip install googleapis-common-protos
Related