繁体   English   中英

无法通过子进程执行blender python

[英]can't execute the blender python through subprocess

我的搅拌机在'/home/abc/Destkop/blender/blender-2.78'的路径上。 当命令行位于路径'/home/abc/Destkop/blender/blender-2.78' ,通过命令行执行'./blender -b /home/abc/Destkop/blender/car.model'正在工作。

我正在尝试通过子进程在 python 中执行搅拌机,但代码无法正常工作,出现错误"/usr/bin/python: can't open file ./blender -b /home/abc/Destkop/blender/car.model" ,但路径没问题

这是我的代码

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

尝试这个:

subprocess.check_call(["./blender", "-b", "/home/abc/Destkop/blender/car.m"])

请注意, shell arg 默认为False ,这意味着args必须是组成命令行的单词序列(列表或元组),而不是单个命令行字符串。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM