本文介绍了模块"six.moves"没有属性"collections_abc"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本可以连接到YouTube API版本3并检索公共数据.此脚本已在气流中部署,可以正常工作一个月,今天它因以下行的此消息而失败:

I have a script that connects to YouTube API version 3 and retrieves public data. This script is deployed in airflow, it was working fine for a month, today it failed with this message for the following line:

def youtube_search(term,region):
        youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=DEVELOPER_KEY,cache_discovery=False)
 File "/usr/local/airflow/.local/lib/python3.6/site-packages/googleapiclient/discovery.py", line 455, in build_from_document
    if isinstance(client_options, six.moves.collections_abc.Mapping):
AttributeError: module 'six.moves' has no attribute 'collections_abc'

我去检查了第455位 discovery.py

if isinstance(client_options, six.moves.collections_abc.Mapping):
        client_options = google.api_core.client_options.from_dict(client_options)

6 模块具有长期未更改,我的脚本也未部署在airflow中,该配置也未更改.

The six module has not changed for a long time, nor has my script deployed in airflow, which config has not changed either.

作为 Google 模块导入了 six ,它没有更改,我不知道为什么会随机出现此错误?

As Google module imports six, which has not changed, I can't figure out why would I get this error at random?

推荐答案

您是在明确指定所使用的google-api-python-client版本,还是仅使用可用的最新版本?

Are you explicitly specifying the version of google-api-python-client that you're using, or just using the latest version available?

9/14/20发布了一个新版本(v1.12.0),随后是一个错误修复版本v.1.12.1,该版本修复了与对 six 的依赖性有关的错误.模块.(来自GitHub的发行说明:要求六个> = 1.13.0(#1030)(4acecc3))

There was a new version (v1.12.0) released on 9/14/20, followed by a bug fix version v.1.12.1 that fixes a bug related to the dependency on the six module. (release notes from GitHub: require six>=1.13.0 (#1030) (4acecc3))

您可能会遇到v1.12.0中的错误.

You may be running into the bug in v1.12.0.

这篇关于模块"six.moves"没有属性"collections_abc"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-12 16:23