【发布时间】:2023-04-10 05:46:01
【问题描述】:
blow 命令在 shell/终端中运行良好,但在我的 python 脚本中使用 subprocess.call() 方法调用它时出现问题。
-- command in shell/terminal
$ th neural_style.lua -gpu 0 -style_image input/style.jpg -content_image input/img.jpg
-- subprocess.call() in python script
# this works
subprocess.call(["th", "neural_style.lua", "-gpu", "0"])
# this goes wrong - Error during read_image: Read Error
-- subprocess.call in the python script
subprocess.call(["th", "neural_style.lua", "-gpu", "0", "-style_image" "input/style.jpg" "-content_image" "input/img.jpg"])
我应该如何使用 subprocess.call ?
【问题讨论】:
-
出了什么问题?您是否收到特定的错误消息?
-
subprocess.call(["th", "neural_style.lua", "-gpu", "0", "-style_image", "input/style.jpg", "-content_image", "输入/img.jpg"])
-
read_image 期间出错:读取错误
-
@JasonD 那会完成什么?
-
"-style_image" "input/style.jpg" "-content_image" "input/img.jpg"之间缺少逗号
标签: python subprocess