'Scene' object has no attribute 'file_format'. What's that mean?

I’m a newbie with python and scripting. Just starting to learn.

I have a .blend file with multiple scenes. I want to quickly be able to change all the render settings on all the scenes so I can batch render them. This is what I have so far:

import bpy

bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080
bpy.context.scene.render.filepath = "//../Renderizados/"
bpy.context.scene.file_format = 'H264'
bpy.context.scene.format = 'AVI'
bpy.context.scene.codec = 'H264'
bpy.context.scene.audio_codec = 'MP3'
bpy.context.scene.audio_bitrate = 192

The first three commands work fine. But the following ones all come up with the same error in the console ‘Scene’ object has no attribute ‘file_format’, ‘format’, ‘codec’, etc…

What’s going wrong? How can this be done?


need to use panel data on the right side
put your cursor over name and check what API command it is

also i think need to specify if in Bl or Cycles mode !

happy bl


Hi there and thank you for your answer.

I’m using the video sequencer only for editing videos. At the moment the render engine is set to internal.

I have tried what you said and I’m not sure what i have to type. In your example I guess I would have to type:

bpy.data.scenes[“SceneName”].render.filepath = ‘/file/path/’

I have tried but I keep getting syntax errors. I’ve tried different combinations.

how about something like this

import bpy

w = 1200
h = 800

bpy.context.scene.render.filepath = 'pathToOutputImage'
bpy.context.scene.render.resolution_x = w 
bpy.context.scene.render.resolution_y = h

happy bl

import bpy
from bpy import context
scene = context.scene

scene.render.resolution_x = 1920
scene.render.resolution_y = 1080
scene.render.filepath = "//../Renderizados/"
scene.render.image_settings.file_format = 'XVID'
scene.render.ffmpeg.format = 'AVI'
scene.render.ffmpeg.codec = 'H264'
scene.render.ffmpeg.audio_codec = 'MP3'
scene.render.ffmpeg.audio_bitrate = 192

Thank you very much batfinger. That worked fine and didn’t give me any errors.

I find it quite misleading that neither the info bar nor the tooltip window showed me what you typed to make it work. Is there anywhere I can find the exact text for each parameter that can be used in a script?

Thank you everybody for your help.