I cannot figure out why the following line of code throws the error "AttributeError: 'NoneType' object has no attribute 'rotation_euler'"

bpy.context.scene.camera.rotation_euler =(0,0,0)
  • 1
    $\begingroup$ If the scene has no camera then scene.camera is None it can also be set to None Having the value None is the error. $\endgroup$
    – batFINGER
    Nov 14, 2019 at 1:29
  • $\begingroup$ @batFINGER - the camera exists, and when I put the code at the beginning of the script it still throws the error. So it's not being set to None at runtime. Suggestions? $\endgroup$
    – vndep
    Nov 14, 2019 at 1:46
  • 1
    $\begingroup$ Is it assigned to the scene, ie check the scene properties panel or C.scene.camera in the console. The error message implies it is not set. There can be a zillion cameras in the scene, only one (or none) at any point in timeline is the "scene camera" $\endgroup$
    – batFINGER
    Nov 14, 2019 at 1:52
  • $\begingroup$ As shown in answer below... To set scene.camera = scene.objects.get("Camera") will set it to camera named "Camera" if it exists, else None. $\endgroup$
    – batFINGER
    Nov 14, 2019 at 2:04

1 Answer 1


If the camera exist but this is NOT set; then you get the error


you must set the camera

setting the camera


You must log in to answer this question.

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