Rap*_*ael 3 python google-app-engine google-cloud-storage
使用 google-cloud-storage 的 Python 项目在本地运行良好,但是当它从 App Engine 运行时,会显示错误:
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'
Run Code Online (Sandbox Code Playgroud)
安装 google-resumable-media==0.6 解决了问题。之前安装的版本是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
Run Code Online (Sandbox Code Playgroud)