我试图在PyDrive中使用duply / duplicity。但是我一直收到一条非常神秘的错误消息,告诉我参考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)'.
答案 0 :(得分:5)
更新2016/04/25:
与python2-oauth2client 2.00的不兼容性已经修正为双重性0.7.07.1(参见changelog)。我刚刚在一个Linux机器上测试它,它完全正常。
原帖如下:
首先,检查你的python2-oauth2client版本。截至编写本版本时,2.00似乎与双重性无关。我不得不降级回1.5.2才能让它再次运作。
其次,确保不存在由不同python版本(OSX内置与自制软件包与手动安装与pip等)引起的冲突。独家使用自制软件可能是个好主意。
第三,确保您的pydrive配置完成。以下是关于如何使用“普通”Google用户帐户执行此操作的简要说明:
使用以下内容在某处创建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
client_id 和 client_secret 可以在Google Developers Console启用后从Google Drive API的API管理器获取。
将 save_credentials_file 设置为pydrive成功连接后可以缓存身份验证数据的任意位置(例如/etc/duply/pydrive.json
或~/etc/pydrive.json
)。
通过设置 GOOGLE_DRIVE_SETTINGS shell变量来完成此操作:
$ export GOOGLE_DRIVE_SETTINGS=/etc/duply/pydrive.conf
您可能希望将其添加到~/.bashrc
,以便所有shell会话都自动设置它。
引自duplicity手册页:
在首次运行期间,系统会提示您访问您的网址 浏览器授予对驱动器的访问权限。一旦获得批准,您将收到 用于粘贴回Duplicity的验证码。凭证是 然后缓存在上面的文件引用中以备将来使用。
......你已经完成了。
如果仍然无效,请检查文件权限:用户是否对上面指定的配置文件运行了双重权限?
答案 1 :(得分:0)
与python2-oauth2client版本2.00相同的问题。通过降级到python2-oauth2client 1.5.2来解决。适用于Christian Mund的指示。
答案 2 :(得分:-1)
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。