Incorrect logging level for `oauth2client.contrib.locked_file` (ref #427)
See original GitHub issueThis is - as per request in the original #427 - a follow-up issue.
The function documentation says:
Detects an appropriate cache module and returns it. Returns
googleapiclient.discovery_cache.base.Cache
, a cache object which is auto detected, orNone
if no cache object is available.
Exceptions in this context only provide a pythonic way to do control flow, and do not indicate anomalies or malfunctioning of the code. None
is a perfectly fine, as-per-specifications behaviour. The correct level should probably be INFO
.
Also, even if you would stand by the WARNING
level, you should tidy up the messy log message. This is what the user is met with:
Traceback (most recent call last):
File "/home/mac/dev/flashfaces/flashfaces/lib/python3.8/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 "/home/mac/dev/flashfaces/flashfaces/lib/python3.8/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 "/home/mac/dev/flashfaces/flashfaces/lib/python3.8/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 "/home/mac/dev/flashfaces/flashfaces/lib/python3.8/site-packages/googleapiclient/discovery_cache/__init__.py", line 42, in autodetect
from . import file_cache
File "/home/mac/dev/flashfaces/flashfaces/lib/python3.8/site-packages/googleapiclient/discovery_cache/file_cache.py", line 40, in <module>
raise ImportError(
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
A saner way to to communicate with the user could potentially be:
WARNING - No caching available (file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:7 (1 by maintainers)
Top GitHub Comments
Same/similar issue here.
Getting the following when instantiating a Google Drive client:
This is causing issues in our monitoring stack because we consider logs with ‘Traceback’ in them to be unhandled exceptions and this warning message results in false positives.
So far my solution has been to lock
oauth2client
under 1.5.2, which is what I get when specifying < 4.0.0 in myrequirements.txt
.@mysticaltech Thank you. That worked well!