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$
2
$\begingroup$

These need to be separate elements in the array:

        '--render-output', '/home/username/Sites/project/output/hello.png',
        '--render-frame', '1'
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.