1

我正在尝试对 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)'.
4

3 回答 3

5

2016 年 4 月 25 日更新:

自重复 0.7.07.1 起,与 python2-oauth2client 2.00 的不兼容性已得到修复(请参阅更改日志)。我刚刚在 Linux 机器上对其进行了测试,它工作得非常好。

原帖如下:

首先,检查您的 python2-oauth2client 版本。在编写此版本 2.00 时,似乎还不能处理重复性问题。我不得不降级回 1.5.2 才能让它再次工作。

其次,确保没有因不同 python 版本引起的冲突(OSX 内置 vs. homebrew 包 vs. 手动安装 vs. pip 等)。专门使用自制软件可能是个好主意。

第三,确保你的 pydrive 配置是完整的。以下是有关如何使用“普通”Google 用户帐户执行此操作的简要说明:

第 1 步:创建 pydrive 后端配置文件

/etc/duply/pydrive.conf在某处(例如或~/etc/pydrive.conf)创建一个具有以下内容的 pydrive 配置文件:

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

第 2 步:告诉 duplicity 在哪里找到它

这是通过设置GOOGLE_DRIVE_SETTINGS shell 变量来完成的:

$ export GOOGLE_DRIVE_SETTINGS=/etc/duply/pydrive.conf

您可能希望将其添加到您的~/.bashrc,以便所有 shell 会话都自动设置它。

第三步:首次认证

正如从重复手册页中引用的那样:

在第一次运行期间,系统将提示您访问浏览器中的 URL 以授予对驱动器的访问权限。一旦获得批准,您将收到一个验证码以粘贴回 Duplicity。然后将凭据缓存在上面的文件引用中以供将来使用。

...你就完成了。

故障排除

如果这仍然不起作用,请检查文件权限:运行 duplicity 的用户是否对上面指定的配置文件有足够的权限?

于 2016-02-29T09:42:31.963 回答
0

python2-oauth2client 2.00版对我来说同样的问题。通过降级到 python2-oauth2client 1.5.2 解决。与 Christian Mund 的说明配合得很好。

于 2016-03-03T12:12:25.900 回答
-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。

于 2019-10-11T08:13:41.853 回答