Duplicity在上传到googlecloudstorag时给出了一个TypeError

2024-04-29 06:13:04 发布

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

我有一个备份脚本,一直运作良好。我最近更新了我的操作系统(到ubuntu19.10),并试图安装所有的依赖项,但我得到了一个错误。你知道吗

我的剧本是这样的:

export PASSPHRASE="passphrase"
PATH=$PATH:/home/jeremy/.boto
export HOME='/home/jeremy/'

DATE=`date +%Y-%m-%d:%H:%M:%S`

echo "Running backup at $DATE" >> /home/jeremy/.backup/log

duplicity --full-if-older-than 1M \
          --archive-dir /home/jeremy/.cache/duplicity/ \
          /home/jeremy \
          gs://x1_carbon_backup >> /home/jeremy/.backup/log

我用gsutil创建了.boto文件,并且我可以成功地使用gsutil,因此身份验证似乎正在工作。你知道吗

回溯看起来像是一个编码/解码问题,但我不知道这是我如何做事的问题还是botoduplicity中的错误

Traceback (innermost last):
  File "/usr/bin/duplicity", line 107, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 93, in with_tempdir
    fn()
  File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
    return factory(pu)
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
    self.resetConnection()
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
    location=self.my_location)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
    data=get_utf8_value(data))
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 659, in make_request
    auth_path = self.calling_format.build_auth_path(bucket, key)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 94, in build_auth_path
    path = '/' + bucket
 TypeError: can only concatenate str (not "bytes") to str

我尝试按照建议的here对bucket变量进行解码。你知道吗

现在我得到一个SSLCertVerificationError,如下:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 163, in <module>
    if u"Forced assertion for testing" in util.uexc(e):
  File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
    return fsdecode(m)
  File "/usr/lib/python3.7/os.py", line 822, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
Backup complete. Checking for old backups to remove
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 107, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 93, in with_tempdir
    fn()
  File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1522, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1200, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in get_backend_object
    return factory(pu)
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 173, in __init__
    self.resetConnection()
  File "/usr/lib/python3/dist-packages/duplicity/backends/_boto_single.py", line 199, in resetConnection
    location=self.my_location)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/gs/connection.py", line 95, in create_bucket
    data=get_utf8_value(data))
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/s3/connection.py", line 671, in make_request
    retry_handler=retry_handler
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1071, in make_request
    retry_handler=retry_handler)
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 1030, in _mexe
    raise ex
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/connection.py", line 943, in _mexe
    request.body, request.headers)
  File "/usr/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/home/jeremy/.local/lib/python3.7/site-packages/boto/https_connection.py", line 131, in connect
    ca_certs=self.ca_certs)
  File "/usr/lib/python3.7/ssl.py", line 1238, in wrap_socket
    suppress_ragged_eofs=suppress_ragged_eofs
  File "/usr/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/usr/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 163, in <module>
    if u"Forced assertion for testing" in util.uexc(e):
  File "/usr/lib/python3/dist-packages/duplicity/util.py", line 120, in uexc
    return fsdecode(m)
  File "/usr/lib/python3.7/os.py", line 822, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int

Tags: inpyselfbackendhomelibpackagesusr