gpt4 book ai didi

python - 从本地 python 脚本运行 AWS cli 命令?

转载 作者:行者123 更新时间:2023-11-28 22:33:08 25 4
gpt4 key购买 nike

<分区>

我正在尝试运行这个 aws s3 ls 命令:

aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize

用这条 python :

command = 'aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize'
s3_folder_data = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
print s3_folder_data

但它失败并出现此错误:

subprocess.CalledProcessError: Command 'aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize' returned non-zero exit status 1

命令本身在我运行时起作用。同一台机器上的同一用户正在调用 python 脚本。给了什么?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com