gpt4 book ai didi

python - 子进程 cp 返回错误 - bufsize 必须是整数

转载 作者:太空狗 更新时间:2023-10-29 22:18:34 25 4
gpt4 key购买 nike

<分区>

我正在尝试从一个目录复制到另一个目录,并通过像这样调用“cp”同时重命名它们:

directories = ['/Users/Me/Folder1/File1.txt', '/Users/Me/Folder/File2.txt']
output = ['/Users/Me/Folder2/Hello.txt', 'Users/Me/Folder2/World.txt']
for in, out, in zip(directories, output):
subprocess.call('cp', in, out)

但它返回:

 File "./test.py", line 33, in <module>
subprocess.call('cp', in, out)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 659, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer

我做错了什么?

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