我正在尝试在PyDrive中使用重复/重复性。但是,我不断收到一条非常神秘的错误消息,告诉我要参考 PyDrive 安装手册页。这没有提供解决方案。
这是我正在运行的 duply 命令的输出,包括错误。
$ duply mac-mini.gdrive status
Start duply v1.11.1, time is 2016-02-20 19:28:59.
Using profile '/etc/duply/mac-mini.gdrive'.
Using installed duplicity version 0.7.06, python 2.7.10, gpg 1.4.19 (Home: ~/.gnupg), awk 'awk version 20070501', grep 'grep (BSD grep) 2.5.1-FreeBSD', bash '4.3.42(1)-release (x86_64-apple-darwin14.5.0)'.
Checking TEMP_DIR '/tmp' is a folder and writable (OK)
Test - En/Decryption skipped. (GPG disabled)
--- Start running command STATUS at 19:29:00.000 ---
BackendException: PyDrive backend requires PyDrive installationPlease read the manpage to fix.
19:29:00.000 Task 'STATUS' failed with exit code '23'.
--- Finished state FAILED 'code 23' at 19:29:00.000 - Runtime 00:00:00.000 ---
我正在运行OS X 10.11.3,安装了brew和pip。我已经使用 pip 来安装 pydrive。
$ pip install pyDrive
Requirement already satisfied (use --upgrade to upgrade): pyDrive in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client>=1.2 in /Library/Python/2.7/site-packages (from pyDrive)
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.0 in /Library/Python/2.7/site-packages (from pyDrive)
Requirement already satisfied (use --upgrade to upgrade): six<2,>=1.6.1 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): oauth2client<3,>=2.0.0 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): httplib2<1,>=0.8 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): uritemplate<1,>=0.6 in /Library/Python/2.7/site-packages (from google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /Library/Python/2.7/site-packages (from oauth2client<3,>=2.0.0->google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in /Library/Python/2.7/site-packages (from oauth2client<3,>=2.0.0->google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in /Library/Python/2.7/site-packages (from oauth2client<3,>=2.0.0->google-api-python-client>=1.2->pyDrive)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in /Library/Python/2.7/site-packages (from uritemplate<1,>=0.6->google-api-python-client>=1.2->pyDrive)
为了参考,我正在运行当前版本的双重性和双重性。
$ duply -V
duply version 1.11.1
(http://duply.net)
Using installed duplicity version 0.7.06, python 2.7.10, gpg 1.4.19 (Home: ~/.gnupg), awk 'awk version 20070501', grep 'grep (BSD grep) 2.5.1-FreeBSD', bash '4.3.42(1)-release (x86_64-apple-darwin14.5.0)'.
更新 2016/04/25:
与python2-oauth2client 2.00的不兼容已从duplicity 0.7.07.1开始修复(请参阅更新日志)。我刚刚在Linux机器上测试了它,它工作得很好。
原文如下:
首先,检查你的python2-oauth2client版本。在撰写本文时,此版本2.00似乎还不适用于重复性。我不得不降级回 1.5.2 才能让它再次工作。
其次,确保没有由不同的python版本引起的冲突(OSX内置与自制软件包,手动安装与pip等)。只使用自制软件可能是个好主意。
第三,确保您的 pydrive 配置已完成。以下是有关如何使用"普通"Google用户帐户执行此操作的快速概述:
步骤 1:创建 pydrive 后端配置文件
在某处创建一个 pydrive 配置文件(例如。 /etc/duply/pydrive.conf
或~/etc/pydrive.conf
)包含以下内容:
client_config_backend: settings
client_config:
client_id: <client-id-string>.apps.googleusercontent.com
client_secret: <client-secret-string>
save_credentials: True
save_credentials_backend: file
save_credentials_file: </path/to/save/authdata.json>
get_refresh_token: True
启用 Google 云端硬盘 API 后,可以从 Google 开发者控制台的 API 管理器获取client_id和client_secret。
将save_credentials_file设置为任意位置,pydrive 可以在成功连接后缓存身份验证数据(例如。
/etc/duply/pydrive.json
或~/etc/pydrive.json
)。
第 2 步:告诉口是心非在哪里可以找到它
这是通过设置 GOOGLE_DRIVE_SETTINGS shell 变量来完成的:
$ export GOOGLE_DRIVE_SETTINGS=/etc/duply/pydrive.conf
您可能希望将其添加到~/.bashrc
以便所有 shell 会话都自动设置它。
步骤 3:首次进行身份验证
正如引用自双重手册页:
在第一次运行期间,系统将提示您访问 浏览器以授予对驱动器的访问权限。一旦获得批准,您将收到 要粘贴回重复性的验证码。凭据是 然后缓存在上面的文件引用中以备将来使用。
。大功告成。
故障 排除
如果这仍然不起作用,请检查文件权限:运行 duplicity 的用户是否对上面指定的配置文件有足够的权限?
python2-oauth2client 版本 2.00 对我来说同样的问题。通过降级到 python2-oauth2client 1.5.2 来解决。与克里斯蒂安·蒙德的指示配合使用。
Duplicity 0.7.10 是一个 Python 2 脚本。如您所见:
➜ ~ head $(which duplicity)
#!/usr/bin/env python2
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# duplicity -- Encrypted bandwidth efficient backup
# Version 0.7.10 released August 20, 2016
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
因此,请确保运行 Python 2 而不是 Python 3。