簡體   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