【问题标题】:gsutil rsync returns error when called by Python 3.5.2, but okay from command line当 Python 3.5.2 调用 gsutil rsync 时返回错误,但从命令行可以
【发布时间】:2023-04-02 18:33:02
【问题描述】:

我有一个 gsutil rsync 调用,它可以在命令行中正常工作,但是当被 subprocess.run 调用时,它会返回一个 stderr 'CommandException: rsync 命令最多接受 2 个参数。'

我在 gsutil 文档的任何地方都没有发现这个限制。

我的参数是 ['/Users/username/google-cloud-sdk/bin/gsutil', 'rsync', '-CderU', '-x' './[.].$', '/ Users/username/Documents/_Projects/Active Projects/myFolder', 'gs://myBucket/myFolder', '2>>', '/Users/username/Library/Logs/gCloud/2016_12_07.log']

当我通过 shlex 运行我的完整命令时,结果如上所示。我还将“-CderU”和“-x”组合成“-CderUx”,但得到相同的结果。

我正在运行 Python 3.5.2,并且在 Mac OS 10.11.6 下拥有最新版本的 gsutil。

任何指导表示赞赏。

【问题讨论】:

    标签: python-3.x google-cloud-storage gsutil


    【解决方案1】:

    gsutil (尚)不支持 Python 3.x.x - 目前仅支持 Python 2.7。所以你需要使用那个版本的 Python。它记录在 here 等其他地方。

    【讨论】:

      猜你喜欢
      • 2021-02-26
      • 2023-04-07
      • 2018-03-08
      • 2014-10-01
      • 1970-01-01
      • 2021-01-17
      • 1970-01-01
      • 1970-01-01
      • 2021-03-22
      相关资源
      最近更新 更多