Floating point values being rounded to nearest integer (example in first post)

Hi all,

I’m trying to write a script to extract certain settings from a provided blender file. One of the setting I want to get is the frames per second. I notice that some of the FPS presets have a decimal part to them (“29.97”). When I try to retrieve this value through a python script, I notice the value is rounded to the nearest whole integer value (“30”, in this case). Why is that, is this a bug, or can I somehow get the “proper” value from within the builtin python? Thanks,


import bpy;
print(bpy.data.scenes['Scene'].render.fps);

-David

If you change FPS to custom, you’ll see that fps is 30, but the fps base is 1.001

You should always use this formula:

render = bpy.context.scene.render
fps = render.fps / render.fps_base