You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
file_cache is unavailable when using oauth2client >= 4.0.0 #299
After upgrading google-api-python-client and oauth2client I get:
Oct 23 11:26:30 admin [11:26:30][WARNING] googleapiclient.discovery_cache init.py:autodetect:44 | file_cache is unavailable when using oauth2client >= 4.0.0#012Traceback (most recent call last):#12 File "/usr/share/python/.../local/lib/python2.7/site-packages/googleapiclient/discovery_cache/init.py", line 41, in autodetect#012 from . import file_cache#012 File "/usr/share/python/..../local/lib/python2.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in #12 'file_cache is unavailable when using oauth2client >= 4.0.0')#012ImportError: file_cache is unavailable when using oauth2client >= 4.0.0
I know that it was added to add oauth2client support (which I appreciate) and from what I can see doesn't actually abort any action - but would it be possible to remove the WARNING as well - or is it meant as a future todo?
It's not a huge issue, but possibly confusing to others - not to mention my eyes stopping at it every time I view any logs or monitoring.
Reacted by Andrey Zhukov, Lucas Connors, Vasily Marnopolsky, Connor Sullivan, Kerry Ivan Kurian, Maximilian Roos, WiliTest, duffn, Jun Makii, Michael Martinez and 38 more
Reacted by YAMASAKI Masahide, Guille and Hashim Gulzar
Reacted by Hrishikesh (Hrish) Barua, Konstantin Sokolovskii, ksk-uchi, Nicolas Fouché, Alexandr N. Zamaraev, Timothy Makobu, Lukas Innig, SendVibe, Chao, Grégory Pakosz and 20 more
Reacted by fw-aaronl, A. Lloyd Flanagan, Aditya Rajput, Rheeya Uppaal, chad-shiftline and Michael B. Currie
Reacted by cooach, Rune Tech, Felipe Mica and SM CheeseNick
Reacted by SendVibe, Alexey Vazhnov, Nikita Shupeyko, gseva, Maxime Vdb, Guiomar Valderrama, an3uryzm, Akos Korsos, km, Mayur Dhurpate and 28 more
Are we sure that this is that simple? I have a project that I'm getting reports of seizing/crashing/weirdness with and I'm seeing these all over the log (no other issues):
2016-12-08 20:11:27,816 [googleapiclient.discovery_cache WARNING] file_cache is unavailable when using oauth2client >= 4.0.0
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
from . import file_cache
File "/usr/lib/python2.7/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
These are ImportErrors, not just mere log verbosity. Thoughts?
Reacted by Connor Sullivan, Peter Novotnak, Simon Kirsten, Jun Makii, Munsanje Mweene, Kevin Bock, Satish Reddy, Ethan, Raphael Dumas, Guiomar Valderrama and 13 more
It's worth mentioning that my version reference to google-api-python-client hasn't changed in over 2.5 years. I can't fathom why I haven't seen this error before and why it appears to be an issue now. But, it does appear to be an exception which must be disrupting something whether it's specifically related to my user's issue or something silent from the logs is responsible for that.
I apologize to comment on closed issue, but is there any performance penalty when the file_cache is not used with oauth2client 4.0.0? I.e. should I keep the oauth2client 3.0.0 or may I safely upgrade and ignore the warning? Thanks.
It seems to be the better way to silence this error, if one does not care about the cache, is to simply specify cache_discovery=False when performing discovery.build() -- this avoids the broken code path.
Reacted by Sathyajith Bhat, Pedro Devoto, Costa Huang, Srđan Marković, ikod, WiliTest, Ondrej Medek, Simon Kirsten, srkn, Steven Hartland and 143 more
Reacted by jeffreykira, NikitaVlaznev, Alex Ribeiro, Maezawa Toshiyuki, Malhotra, Ahmed Hosny, Nithish Reddy, Noah Broyles, fw-aaronl and Lucas Weber
Reacted by mark-thompson, Jeremy Meyer, vigneshprajapati, sp-philippe-oger, Michael Ghen, Nidhin Pattaniyil, Franklyn Dsouza, jeffreykira, graham, Chris Herbert and 15 more
Reacted by Guillaume Algis, Sathyajith Bhat, Harrison, Costa Huang, Simon Kirsten, Kerry Ivan Kurian, Kim Thoenen, slilo, Jun Makii, Robert Lacok and 46 more
maxrp solution worked (python3.6) for most logging message: discovery.build('drive', 'v3', http=http, cache_discovery=False)
but I also needed to set the logging level of the googleapiclient.discovery using jonparrott proposition: logging.getLogger('googleapiclient.discovery').setLevel(logging.CRITICAL)
Reacted by Tony Hung, kawa, Donald Luc, okmttdhr, tada, Alexandros Nicolaides, Ohad Basan, RocketSharck, Masayoshi Mizutani, rasmi, Andriy Kovalchuk and 17 more
Reacted by Roman Sheydvasser, Felipe Gonzalez, Abhinav Kumar, Chad Morton, Israel Mendes - Caylent and fw-aaronl
Reacted by bencaine1, sash0, Paolo D., Samuel, pb, jessebrennan, Johannes Bader, Tai Ho, David Janes, Peter Sobot and 3 more
Reacted by SendVibe, Michele Trevisiol, Nick Hughes, Alexander Serebrov, Maykel Moya, bencaine1, BD Himes, Paolo D., Tai Ho, Pablo PRUDHOMMEAU and 1 more
Reacted by Yiyun Lei, Roberto Simonetti, Athanasios Skrepetos, John Chen, Vasily Maryutenkov, oscar, Jack P, Michael B. Currie, bendecko and Anya-Aurore Mauron
Activity
theacodes commentedon Oct 24, 2016
You can silence this the same way you can silence any other log using the standard library logging infrastructure:
bivald commentedon Oct 25, 2016
Of course you can! I apologize, I blame the lack of coffee for my ignorance.
theacodes commentedon Oct 25, 2016
No worries. :)
dsoprea commentedon Dec 8, 2016
Are we sure that this is that simple? I have a project that I'm getting reports of seizing/crashing/weirdness with and I'm seeing these all over the log (no other issues):
These are ImportErrors, not just mere log verbosity. Thoughts?
dsoprea commentedon Dec 8, 2016
It's worth mentioning that my version reference to google-api-python-client hasn't changed in over 2.5 years. I can't fathom why I haven't seen this error before and why it appears to be an issue now. But, it does appear to be an exception which must be disrupting something whether it's specifically related to my user's issue or something silent from the logs is responsible for that.
theacodes commentedon Dec 8, 2016
@dsoprea if you silence the logs as above, do you still see the stacktrace?
dsoprea commentedon Dec 8, 2016
@jonparrott I've asked. Thanks.
xmedeko commentedon Dec 22, 2016
I apologize to comment on closed issue, but is there any performance penalty when the file_cache is not used with oauth2client 4.0.0? I.e. should I keep the oauth2client 3.0.0 or may I safely upgrade and ignore the warning? Thanks.
maxrp commentedon Dec 22, 2016
It seems to be the better way to silence this error, if one does not care about the cache, is to simply specify cache_discovery=False when performing discovery.build() -- this avoids the broken code path.
disable discovery cache to prevent
WiliTest commentedon Mar 21, 2017
maxrp solution worked (python3.6) for most logging message:
discovery.build('drive', 'v3', http=http, cache_discovery=False)but I also needed to set the logging level of the googleapiclient.discovery using jonparrott proposition:
logging.getLogger('googleapiclient.discovery').setLevel(logging.CRITICAL)Turn off cache discovery as it stacktraces noisily. See googleapis/go…
Fix ImportError in calendar
sendvibe commentedon Nov 9, 2017
jonparrott's answer almost worked for me.... you just have to fix the typo:
import logging
logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR)
26 remaining items
remove 'oauth2client.locked_file' by disabling the cache
mohitjoshi155 commentedon May 20, 2022
file_cache is only supported with oauth2client<4.0.0
i am getting this error still
sabuhigr commentedon Jun 21, 2022
init: file_cache is only supported with oauth2client<4.0.0
Still getting error.
mabusdogma commentedon Nov 11, 2022
Still... still getting this error
rnag commentedon Apr 13, 2023
Same.. please fix. Tuning down error log messages is a workaround rather than a fix.
trizko commentedon Aug 9, 2023
For anyone landing on this issue in 2023, maxrp's solution from 2016 still works, setting
cache_discovery=False:turn cache_discovery off per googleapis/google-api-python-client#299
turn cache_discovery off per googleapis/google-api-python-client#299
Disable "file_cache is unavailable" warning
Upgrade to Python 3.11 and GAE Gen 2 (#29)
avoid broken code path in googleapi client
disable cache discovery per googleapis/google-api-python-client#299
Fix complaints about caching
feat(persona): add PersonaRefreshJob (Drive->Firestore pipeline) -- F…
feat(persona): add PersonaRefreshJob (Drive->Firestore pipeline) -- F…