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'

1 Answer 1


It's a very specific issue that is very unlikely to be encountered by many users. I wouldn't try to bother the devs with it by reporting a bug. I also don't think it is very likely to be addressed to be honest.

I would try to make it an add-on instead and use bpy.app.handlers.load_post with @persistent

I would also try to check what render engine is active in the file first and it might be smart to limit it to only one viewport instead of all existing - what if you have many viewports open?.. Might not be a good idea to start rendering all of them instantly.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .