0
$\begingroup$

I have the following code in a file named call.py, which I've reduced down for debugging.

Note: I've tried various paths, either using os.path (join) or absolutes, as seen below:

import subprocess

args = [
        '/usr/bin/blender',
        '--background',
        '--factory-startup',
        '/home/username/Sites/project/blends/3d-text.blend',
        '--render-output /home/username/Sites/project/output/hello.png',
        '--render-frame 1'
        ]

subprocess.run(args)

If I run the args directly from the terminal it works:

/usr/bin/blender --background --factory-startup /home/username/Sites/project/blends/3d-text.blend --render-output /home/username/Sites/project/output/hello.png --render-frame 1

If I call the call.py script itself, either from terminal or within VS Code, in this case, using subprocess, it doesn't work and I get the following error:

➜  project /usr/bin/python3 /home/username/Sites/project/python/call.py
Blender 2.82 (sub 7) (hash 5b416ffb848e built 2020-02-28 18:18:05)
Read blend: /home/username/Sites/project/blends/3d-text.blend
Dependency cycle detected:
MAMaterial/Shading Component/MATERIAL_UPDATE() depends on
NTShader Nodetree/Shading Component/MATERIAL_UPDATE() via 'Material's NTree'
MAMaterial/Shading Component/MATERIAL_UPDATE() via 'Material -> Node'
Dependency cycle detected:
NTShader Nodetree/Shading Component/MATERIAL_UPDATE() depends on
MABlue/Shading Component/MATERIAL_UPDATE() via 'Material -> Node'
NTShader Nodetree/Shading Component/MATERIAL_UPDATE() via 'Material's NTree'
Detected 2 dependency cycles
unknown argument, loading as file: --render-output /home/username/Sites/project/output/hello.png
Error: Cannot read file '/home/username/Sites/project/--render-output /home/username/Sites/project/output/hello.png': No such file or directory

Blender quit

Any thoughts on why it's not working?

  • Blender 2.82
  • Python 3.8.1
  • VS Code
  • Manjaro KDE 19.0.2

Blender 2.82 Manual: Command Line Arguments

$\endgroup$

1 Answer 1

2
$\begingroup$

These need to be separate elements in the array:

        '--render-output', '/home/username/Sites/project/output/hello.png',
        '--render-frame', '1'
$\endgroup$
1
  • $\begingroup$ I literally just figured that out, thanks to this answer: blender.stackexchange.com/a/146261/69262 - I was coming back to answer my own question, in fact so, thank you as well! $\endgroup$
    – Natetronn
    Commented Mar 10, 2020 at 3:32

You must log in to answer this question.

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