问题
After upgrading to the new google-api-python-client
1.8.1 I'm receiving this error. Do we know if python 3.8 breaks the latest google-api-core
? And whether there's a solution
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.8/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/prosebit/prosebit/app.py", line 10, in <module>
from prosebit.blueprints.page import page
File "/prosebit/prosebit/blueprints/page/__init__.py", line 1, in <module>
from prosebit.blueprints.page.views import page
File "/prosebit/prosebit/blueprints/page/views.py", line 4, in <module>
from prosebit.blueprints.page.gmail import get_google_auth, ListHistory, add_to_watch,
is_meter_data, ListMessagesMatchingQuery, GetMessage, send_message, get_daily_threadid,
ModifyMessage, create
MsgLabels, get_new_messages
File "/prosebit/prosebit/blueprints/page/gmail.py", line 32, in <module>
from apiclient import errors
File "/usr/local/lib/python3.8/site-packages/apiclient/__init__.py", line 22, in <module>
__version__ = googleapiclient.__version__
AttributeError: module 'googleapiclient' has no attribute '__version__'
Here are my dependencies:
Successfully installed Blinker-1.4 Click-6.4 Flask-1.1.1 Flask-Login-0.4.1 Flask-Mail-0.9.1 Flask-
SQLAlchemy-2.4.1 Flask-WTF-0.14.3 Jinja2-2.11.2 MarkupSafe-1.1.1 SQLAlchemy-1.3.7 SQLAlchemy-Utils-0.36.3 WTForms-2.
2.1 WTForms-Alchemy-0.16.9 WTForms-Components-0.10.4 amqp-2.5.2 atomicwrites-1.3.0 attrs-19.3.0 billiard-3.6.3.0 cachetools-4.1.0 celery-4.4.0 certifi-2020.4.5.1 chardet-3.0.4 coverage-5.1 decorator-4.4.2 entrypoin
ts-0.3 faker-3.0.0 flake8-3.7.8 flask-debugtoolbar-0.10.1 gocardless-pro-1.10.0 google-api-core-1.16.0 google-api-python-client-1.8.1 google-auth-1.14.0 google-auth-httplib2-0.0.3 google-auth-oauthlib-0.4.1 google-
cloud-pubsub-1.4.3 googleapis-common-protos-1.51.0 grpc-google-iam-v1-0.12.3 grpcio-1.28.1 gunicorn-19.9.0 httplib2-0.17.2 idna-2.9 infinity-1.4 intervals-0.8.1 itsdangerous-1.1.0 kombu-4.6.8 mccabe-0.6.1 mock-3.0.
5 more-itertools-8.2.0 oauth2client-4.1.3 oauthlib-3.1.0 packaging-20.3 pluggy-0.13.1 protobuf-3.11.3 psycopg2-2.8.4 py-1.8.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycodestyle-2.5.0 pyflakes-2.1.1 pyparsing-2.4.7 pytes
t-5.1.0 pytest-cov-2.7.1 python-dateutil-2.8.1 pytz-2019.3 redis-3.3.11 requests-2.23.0 requests-oauthlib-1.3.0 rsa-4.0 six-1.14.0 stripe-2.41.0 text-unidecode-1.3 uritemplate-3.0.1 urllib3-1.25.9 validators-0.14.3
vine-1.3.0 wcwidth-0.1.9 werkzeug-1.0.0
回答1:
I had the same error and changing the import fixed it for me. The developers recommend importing from googleapiclient instead of apiclient.
So you will need to change from apiclient import errors
to from googleapiclient import errors
来源:https://stackoverflow.com/questions/61334085/breaking-change-for-google-api-python-client-1-8-1-attributeerror-module-goo