Pydrive后端无法使用Duplicty python

2024-04-28 21:42:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试对PyDrive使用duply/duplicy。但是,我一直收到一条非常神秘的错误消息,告诉我要参考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。在

^{pr2}$

作为参考,我运行了duplicity和duply的当前版本。在

$ 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)'.

Tags: installedisversionmac错误gpgstartgrep
3条回答

python2-oauth2client版本2.00对我也有同样的问题。通过降级到python2-oauth2client 1.5.2解决。使用Christian Mund的指令可以很好地工作。在

更新2016/04/25:

与python2-oauth2client 2.00的不兼容性在duplicy0.7.07.1中已经修复(参见changelog)。我刚刚在Linux系统上测试了一下,它运行得非常好。在

原文如下:

首先,检查python2-oauth2client版本。在编写这个2.00版本时,它似乎还不能起到表里不一的作用。我不得不降到1.5.2才能让它重新工作。在

第二,确保不同的python版本(OSX内置版本与自制软件包、手动安装版本与pip版本等)没有冲突。这可能是个好主意。在

确保PyThird驱动器配置完成。以下是如何使用“普通”谷歌用户帐户的简要说明:

步骤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 Drive API后,可以从Google Developers Console的API管理器获取客户端id和客户端机密。

  • save_credentials_file设置到pydrive成功连接后可以缓存身份验证数据的任意位置(例如/etc/duply/pydrive.json~/etc/pydrive.json)。

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

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

^{pr2}$

{cd5>你可能需要自动添加所有会话。在

第三步:第一次认证

引自Duplicy手册页:

During the first run, you will be prompted to visit an URL in your browser to grant access to your drive. Once granted, you will receive a verification code to paste back into Duplicity. The credentials are then cached in the file references above for future use.

。。。你就完蛋了。在

故障排除

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

Duplicy0.7.10是一个Python2脚本。如你所见:

➜  ~ 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.

所以确保运行python2而不是python3。在

相关问题 更多 >