0
$\begingroup$

This different from Calling Blender From Python Script in that it concentrates on a different part of the code which results in different error messages. It is also a more clearly stated problem.

I have a very simple python script that I copied from How to Run blender from a python program?

import subprocess
subprocess.call("blender", "proj001-master.blend ")

When I run this, I get the following error message:

Traceback (most recent call last): File "testsubprocess.py", line 2, in subprocess.call("blender", "proj001-master.blend ") File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 172, in call return Popen(*popenargs, **kwargs).wait() File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 343, in init raise TypeError("bufsize must be an integer") TypeError: bufsize must be an integer

I changed the code to:

import subprocess
subprocess.Popen("blender", "proj001-master.blend ")

When I run this, I get the following error message:

Traceback (most recent call last): File "testsubprocess.py", line 2, in subprocess.Popen("blender", "proj001-master.blend ") File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 343, in init raise TypeError("bufsize must be an integer") TypeError: bufsize must be an integer

What am I doing wrong here?

$\endgroup$
4
  • 2
    $\begingroup$ If you needed to amend your question you should have used the 'edit' button below it, not asked it again. $\endgroup$ Sep 27, 2018 at 22:09
  • 5
    $\begingroup$ Possible duplicate of Calling Blender From Python Script $\endgroup$ Sep 27, 2018 at 22:09
  • 1
    $\begingroup$ looks like the arguments have to be in a list format stackoverflow.com/questions/17824096/… $\endgroup$
    – rob
    Sep 28, 2018 at 8:07
  • $\begingroup$ I tried: subprocess.call(["blender", "proj001-master.blend"], stdout=PIPE, stderr=PIPE) Same error. $\endgroup$
    – mcgeo52
    Sep 28, 2018 at 8:17

1 Answer 1

1
$\begingroup$

Try

subprocess.Popen(["blender", "proj001-master.blend"])
$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .