Pydrive后端不使用duplicicty - python

jul*_*ert 1 python duplicity

我正在尝试使用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 ---
Run Code Online (Sandbox Code Playgroud)

我正在运行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)
Run Code Online (Sandbox Code Playgroud)

对于referenece,我正在运行当前版本的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)'.
Run Code Online (Sandbox Code Playgroud)

Chr*_*und 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用户帐户执行此操作的简要说明:

第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
Run Code Online (Sandbox Code Playgroud)
  • 启用Google Drive API后,可以从Google Developers Console的API Manager获取client_idclient_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
Run Code Online (Sandbox Code Playgroud)

您可能希望将此添加到您的~/.bashrc所有shell会话中自动设置它.

第3步:第一次进行身份验证

正如duplicity手册页所引用:

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

......你已经完成了.

故障排除

如果仍然无效,请检查文件权限:用户是否对上面指定的配置文件运行了双重权限?