Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'oauth2client.contrib.locked_file' #427

Closed
katsar0v opened this issue Aug 8, 2017 · 8 comments
Closed

ImportError: No module named 'oauth2client.contrib.locked_file' #427

katsar0v opened this issue Aug 8, 2017 · 8 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@katsar0v
Copy link

katsar0v commented Aug 8, 2017

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/katsarov/miniconda3/envs/kpi_dashboard/lib/python3.5/site-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in
from oauth2client.contrib.locked_file import LockedFile
ImportError: No module named 'oauth2client.contrib.locked_file'

Traceback (most recent call last):
File "/home/katsarov/miniconda3/envs/kpi_dashboard/lib/python3.5/site-packages/googleapiclient/discovery_cache/init.py", line 41, in autodetect
from . import file_cache
File "/home/katsarov/miniconda3/envs/kpi_dashboard/lib/python3.5/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in
'file_cache is unavailable when using oauth2client >= 4.0.0')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0

@theacodes
Copy link
Contributor

@katsar0v this is not en error, just a warning. See #345.

@katsar0v
Copy link
Author

katsar0v commented Aug 9, 2017

ImportError is warning? Ok

@benminer
Copy link

🥇

@ucalyptus
Copy link

any remedies?

@lliepins-clgx
Copy link

Any updates?

@Mabloq
Copy link

Mabloq commented Feb 20, 2020

same

@busunkim96
Copy link
Contributor

Hi folks, here's some more explanation since there seems to be interest:

This is a warning, that happens to log the exceptions that were raised. The ImportError is being caught and handled (see code snippet below). This function determines what environment the code is being run to choose the correct cache location. Each import will only work in a specific environment.

def autodetect():
"""Detects an appropriate cache module and returns it.
Returns:
googleapiclient.discovery_cache.base.Cache, a cache object which
is auto detected, or None if no cache object is available.
"""
try:
from google.appengine.api import memcache
from . import appengine_memcache
return appengine_memcache.cache
except Exception:
try:
from . import file_cache
return file_cache.cache
except Exception as e:
LOGGER.warning(e, exc_info=True)
return None

If you have comments to make about a closed issue it's best to open a new issue and reference the previous one. Repository maintainers are less likely to see comments on an already closed issue.

Thanks!

@fullstackadam
Copy link

Disable cache_discovery

discovery.build(api, version, http=http, cache_discovery=False)

https://stackoverflow.com/questions/40154672/importerror-file-cache-is-unavailable-when-using-python-client-for-google-ser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

9 participants