I'm trying to make a script and I'm having trouble with this line:

bpy.data.scenes[0].render.file_format = 'PNG'

And it prints this error:

AttributeError: 'RenderSettings' object has no attribute 'fileformat'

Of course it's no big issue to click the mouse and set it, but I want to find out why it doesn't work. When I hover over the File Format menu in the render settings I see this:

bpy.data.scenes["Scene"] ... file_format

I noticed that there are a few other commands which show "..." in the attribute's "path". I checked out the docs, it doesn't say that file_format is deprecated. I'm using the latest version and Blender's default renderer.

Any idea why it doesn't work?

| improve this question | | | | |

It seems that the path you tried to use only exists in a context for UI elements, from properties_render.py:

def draw(self, context):
    layout = self.layout

    rd = context.scene.render
    image_settings = rd.image_settings
    file_format = image_settings.file_format

    layout.prop(rd, "filepath", text="")

In a script you could use something like:

| improve this answer | | | | |

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.