first of all, thanks for the help you have provided me indirectly through this forum.

I am trying to generate still pictures using blender. I have the python script and the model which are both functioning well but i would like to take the script out of the blender file to be able to generate it with an external macro.

I can currently generate the picture by running the python script from the GUI. I am also able to generate the picture from the command line if I call the script saved within the blender file (Internal_Script.py is inside the blender file).: "C:\Program Files\Blender Foundation\Blender\blender.exe" --background model.blend --python Internal_Script.py -f 1

however, if I take the content of this script and copy it in a file alongside the blend file, it doesn't work any more (External_Script.py is a separate file now). "C:\Program Files\Blender Foundation\Blender\blender.exe" --background model.blend --python External_Script.py -f 1

the python script is definitely being read as i get an error if I misspell the filename.

Error: Cannot render, no camera

This is quite strange as there is definitely a camera and the script works just fine if it's saved in the blender file.

Would you have any idea about what's going on?


1 Answer 1


Check that bpy.context.scene.camera is set to your newly added camera. That property determines which camera is used for rendering, and if it's still None it won't work.

  • $\begingroup$ hi, thanks for your response, I believe that I'm already doing this but using -f rather than the full --render-frame syntax. The reason I need the script is because I am generating the whole model/mesh with python. The blend file contains the materials I an using. $\endgroup$
    – Batwam
    Oct 3, 2014 at 11:14
  • $\begingroup$ Doh! Of course. Have you tried removing the --background option, so that you can see what's going on? $\endgroup$
    – dr. Sybren
    Oct 3, 2014 at 12:27
  • $\begingroup$ if I remove background, the blender window starts but I get the same error. $\endgroup$
    – Batwam
    Oct 3, 2014 at 16:11
  • 1
    $\begingroup$ I've upvoted your question, hopefully that'll give you some more rep ;-) $\endgroup$
    – dr. Sybren
    Oct 8, 2014 at 7:05
  • 1
    $\begingroup$ @hyg53 still waiting for that upvote :) $\endgroup$ May 14, 2015 at 15:56

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.