pior / appsecrets

Python 3.6+ library to manage your application secrets with Google Cloud KMS
https://pypi.org/project/appsecrets/
MIT License
1 stars 0 forks source link

ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 #7

Closed pior closed 6 years ago

pior commented 6 years ago

This is just a warning, but the log produced is pretty scary:

2018-05-14 18:54:34 WARNING googleapiclient.discovery_cache file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
  File "/py/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
    from google.appengine.api import memcache
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/py/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
    from oauth2client.contrib.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/py/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py", line 37, in <module>
    from oauth2client.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/py/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File "/py/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0

Upstream issue: https://github.com/google/google-api-python-client/issues/299

Suggested fix: discovery.build('drive', 'v3', http=http, cache_discovery=False)

https://github.com/pior/appsecrets/blob/ec099939f97ef8f5e677c10a8c4b91c7f1a93e2f/appsecrets/crypto/google_kms.py#L56

elouanKeryell-Even commented 5 years ago

Man I've been scratching my head for way too long on this one, thanks a lot for the cache_discovery=False fix :heart: