I am running the following python script to convert 3dview to rendered view, which works fine in the scripting editor but not if run from the startup folder which reports the following type error error.
TypeError: bpy_struct: item.attr = val: enum "RENDERED" not found in ('WIREFRAME', 'SOLID', 'MATERIAL')
Is this a legitimate bug in Blender (I'm using version 3.2.2) that needs to be reported? Or are scripts behaving differently in the startup folder ? API documentation states Rendered is a valid option. https://docs.blender.org/api/current/bpy.types.View3DShading.html#bpy.types.View3DShading.type
import bpy
import bpy.ops
import bpy.types
for window in bpy.context.window_manager.windows:
for area in window.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces: # iterate through spaces in current VIEW_3D area
if space.type == 'VIEW_3D': # check if space is a 3D view
space.shading.type = 'RENDERED'