首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >raspberry-pi oauth2client库出错

raspberry-pi oauth2client库出错
EN

Stack Overflow用户
提问于 2017-11-27 03:02:54
回答 1查看 491关注 0票数 1

我想上传一个存在于树莓派文件夹中的文本文件。为此,我使用了以下代码:

代码语言:javascript
复制
from pydrive.drive import GoogleDrive
drive = GoogleDrive(gauth)

file1 = drive.CreateFile({'title': 'Hello.txt'})  # Create GoogleDriveFile instance with title 'Hello.txt'.
file1.SetContentString('Hello World!') # Set content of the file from given string.
file1.Upload()

在raspberry pi中运行这段代码,我得到了以下错误:

代码语言:javascript
复制
 Traceback (most recent call last):   File "uploadfile3.py", line 1, in <module>
    from pydrive.drive import GoogleDrive   File "/usr/local/lib/python2.7/dist-packages/pydrive/drive.py", line 2, in <module>
    from .files import GoogleDriveFile   File "/usr/local/lib/python2.7/dist-packages/pydrive/files.py", line 12, in <module>
    from .auth import LoadAuth   File "/usr/local/lib/python2.7/dist-packages/pydrive/auth.py", line 9, in <module>
    from oauth2client.service_account import ServiceAccountCredentials   File "/usr/local/lib/python2.7/dist-packages/oauth2client/service_account.py", line 26, in <module>
    from oauth2client import crypt   File "/usr/local/lib/python2.7/dist-packages/oauth2client/crypt.py", line 23, in <module>
    from oauth2client import _pure_python_crypt   File "/usr/local/lib/python2.7/dist-packages/oauth2client/_pure_python_crypt.py", line 24, in <module>
    from pyasn1_modules.rfc2459 import Certificate   File "/usr/local/lib/python2.7/dist-packages/pyasn1_modules/rfc2459.py", line 20, in <module>
    from pyasn1.type import opentype ImportError: cannot import name opentype

请帮助我删除此错误。如果有其他上传文本文件的方法,请帮我解决。

EN

回答 1

Stack Overflow用户

发布于 2017-11-28 04:35:26

参见https://github.com/etingof/pyasn1-modules/issues/10,我怀疑这与oauth2client的弃用以及pyasn1和pyasn1-module在11/23/17的发布有关。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47499896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档