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 }}
This repository was archived by the owner on Jul 22, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 22, 2021. It is now read-only.
file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth #194
Traceback (most recent call last):
File "/home/runner/.local/share/virtualenvs/python3/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/runner/.local/share/virtualenvs/python3/lib/python3.8/site-packages/googleapiclient/discovery_cache/__init__.py", line 42, in autodetect
from . import file_cache
File "/home/runner/.local/share/virtualenvs/python3/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
I'm getting the same error.
According to googleapis/google-api-python-client#299 you either need to change the logging level import logging logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR)
or disable the cache adding cache_discovery=False in discover.build(api, version, http=http, cache_discovery=False)
The former does not suffice imo. I don't wanna suppress warnings, I'd like them not to occur.
The latter can't be done through PyDrive, it seems.
For me this happens when I initialize the drive object multiple times (I have to do this, since the credential file gets deleted regularly on my hoster (Heroku)) and then try to list files on gdrive.
This is where the error occurs, after having initialized the client 2 times in short succession.
file_list = drive.ListFile({'q': f'\'{self._folder_id}\' in parents and title contains \'{file_name_part}\''}).GetList()
Full error message
[WARNING ] googleapiclient.discovery_cache: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
File "/Users/[...]/.pyenv/versions/3.6.9/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 "/Users/[...]/.pyenv/versions/3.6.9/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 "/Users/[...]/.pyenv/versions/3.6.9/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 "/Users/[...]/.pyenv/versions/3.6.9/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py", line 42, in autodetect
from . import file_cache
File "/Users/[...]/.pyenv/versions/3.6.9/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 or google-auth"
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Activity
kuldeeprishi commentedon Jul 3, 2020
is there any update on this?
shcheklein commentedon Jul 3, 2020
@kuldeeprishi when does this error happen? could you give more context?
Zukunftsmusik commentedon Aug 4, 2020
I'm getting the same error.
According to googleapis/google-api-python-client#299 you either need to change the logging level
import logging logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR)or disable the cache adding
cache_discovery=Falseindiscover.build(api, version, http=http, cache_discovery=False)The former does not suffice imo. I don't wanna suppress warnings, I'd like them not to occur.
The latter can't be done through PyDrive, it seems.
For me this happens when I initialize the drive object multiple times (I have to do this, since the credential file gets deleted regularly on my hoster (Heroku)) and then try to list files on gdrive.
Code
Initializing
ListFiles
This is where the error occurs, after having initialized the client 2 times in short succession.
Full error message
shcheklein commentedon Aug 4, 2020
@Zukunftsmusik hmm 🤔 it looks like https://github.com/gsuitedevs/PyDrive/blob/master/pydrive/auth.py#L523 already sets
cache_discovery=False.Zukunftsmusik commentedon Aug 4, 2020
That's odd. I'm running version 1.3.1 (updated 2016 according to PyPi) and the warning occurs.
The file above has been changed in 2018.
I'll try using
git+https://github.com/googledrive/PyDrive.git#egg=PyDriveinstead.Zukunftsmusik commentedon Aug 4, 2020
Yep, that did it.
thx for the hint 👍
shcheklein commentedon Aug 4, 2020
@Zukunftsmusik you can alternatively use PyDrive2 that we maintain. It has a lot of updates and other fixes.