I'm rendering a scene from the Python interface, and I can't get the python API commands to work from a script.
In the Blender UI I would go to world->Surface->Use Nodes and then adjust the surface color and strength to get the desired light.
From python I run the following commands
bpy.data.scenes['Scene'].render.engine = 'CYCLES' bpy.data.worlds['World'].use_nodes = True bpy.data.worlds['World'].node_tree.nodes['Background'].inputs.default_value[:3] = (1,1,1) bpy.data.worlds['World'].node_tree.nodes['Background'].inputs.default_value = 2.0
If I run these from the Blender Python console they change the values as expected. But when running the commands from a script via
blender -b my_scene.blend -P my_script.py
These commands have no effect. Other commands (moving objects around etc) work from the same script.