[英]can't execute the blender python through subprocess
My blender is at the path of '/home/abc/Destkop/blender/blender-2.78'
.我的搅拌机在
'/home/abc/Destkop/blender/blender-2.78'
的路径上。 When command line is at the path '/home/abc/Destkop/blender/blender-2.78'
, executing './blender -b /home/abc/Destkop/blender/car.model'
through command line is working.当命令行位于路径
'/home/abc/Destkop/blender/blender-2.78'
,通过命令行执行'./blender -b /home/abc/Destkop/blender/car.model'
正在工作。
I am trying to execute blender in python through subprocess, but the code doesn't work with an error "/usr/bin/python: can't open file ./blender -b /home/abc/Destkop/blender/car.model"
, but the path is all right我正在尝试通过子进程在 python 中执行搅拌机,但代码无法正常工作,出现错误
"/usr/bin/python: can't open file ./blender -b /home/abc/Destkop/blender/car.model"
,但路径没问题
here is my code这是我的代码
import os
import sys
import subprocess
if __name__="__main__":
os.chdir("/home/abc/Destkop/blender/blender-2.78")
subprocess.Popen([sys.executable],"./blender -b /home/abc/Destkop/blender/car.m
Try this:尝试这个:
subprocess.check_call(["./blender", "-b", "/home/abc/Destkop/blender/car.m"])
Note that the shell
arg defaults to False
, which means the args
must be a sequence (list or tuple) of words making up the command-line, not a single command-line string.请注意,
shell
arg 默认为False
,这意味着args
必须是组成命令行的单词序列(列表或元组),而不是单个命令行字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.