小编fjs*_*n01的帖子

如何从 python 脚本成功调用 gsutil rsync?

我正在尝试执行以下行

gsutil -m rsync s3://input gs://output
Run Code Online (Sandbox Code Playgroud)

在Python中。在 shell 终端中运行此行时,它工作正常。但是,我尝试使用以下行在 python 脚本中运行它。

subprocess.Popen(["gsutil", "-m", "rsync", "s3://input", "gs://output"])
Run Code Online (Sandbox Code Playgroud)

然而它只是永远挂起。它输出以下内容:

Building synchronization state...
Starting synchronization...
Run Code Online (Sandbox Code Playgroud)

bash命令成功打印:

Building synchronization state...
Starting synchronization...
Copying s3://input/0000
[0/1 files][  1.0 MiB/ 5.1 MiB]   (number here)% Done
Run Code Online (Sandbox Code Playgroud)

该文件显示在我的 gs 存储桶中

python subprocess gsutil google-cloud-platform

2
推荐指数
1
解决办法
2554
查看次数