ezgmail icon indicating copy to clipboard operation
ezgmail copied to clipboard

No module named 'oauth2client.contrib.locked_file'

Open fridde opened this issue 4 years ago • 2 comments

First of all: Thanks for a great package!

When running ezgmail "live" from the python interpreter, everything works just fine, but as I am trying to build a script and run it from my bash, I get this weird exception, but still correct results.

I could just suppress the errors, but since this could lead to problems later on, I thought I'd report it.

Any idea as to what could cause this?

I am running Python 3.8 on WSL (Ubuntu 20.04) and have the most current version of this package.

WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "/home/fridde/.local/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/fridde/.local/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/fridde/.local/lib/python3.8/site-packages/googleapiclient/discovery_cache/__init__.py", line 44, in autodetect
    from . import file_cache
  File "/home/fridde/.local/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

fridde avatar Nov 28 '20 18:11 fridde

This appears to be a warning indicating the Exception is being handled correctly. Check these two issues out for more information: https://github.com/googleapis/google-api-python-client/issues/427 https://github.com/googleapis/google-api-python-client/issues/299

You may be able to silence the warning by adding this to your code:

import logging

logging.getLogger('googleapicliet.discovery_cache').setLevel(logging.ERROR)

cgarrett avatar Dec 03 '20 01:12 cgarrett

As of yesterday, the error level has changed from warning to info in google-api-python-client. See googleapis/google-api-python-client#1125.

parthea avatar Dec 08 '20 12:12 parthea