change pivot point mode with python?

I need to change the pivot mode with python to 3d cursor, and I know you’ve got to use this function:

bpy.ops.wm.context_set_enum(data_path="", value='CURSOR')

But what exactly is the data_path argument?

It tells me it needs one of these:

expected  a string enum in ('INVOKE_DEFAULT', 'INVOKE_REGION_WIN',  'INVOKE_REGION_CHANNELS', 'INVOKE_REGION_PREVIEW', 'INVOKE_AREA',  'INVOKE_SCREEN', 'EXEC_DEFAULT', 'EXEC_REGION_WIN',  'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA',  'EXEC_SCREEN')

What do these mean, is there a reference somewhere that clearly explains this?

Thanks a lot!

try without setting data_path (you get the default) …??

plenty of code here:


class VIEW3D_OT_pivot_cursor(bpy.types.Operator):
    "Cursor as Pivot Point"
    bl_idname = "view3d.pivot_cursor"
    bl_label = "Cursor as Pivot Point"

    @classmethod
    def poll(cls, context):
        return bpy.context.space_data.pivot_point != 'CURSOR'

    def execute(self, context):
        bpy.context.space_data.pivot_point = 'CURSOR'
        return {'FINISHED'}

class VIEW3D_OT_revert_pivot(bpy.types.Operator):
    "Revert Pivot Point"
    bl_idname = "view3d.revert_pivot"
    bl_label = "Reverts Pivot Point to median"

    @classmethod
    def poll(cls, context):
        return bpy.context.space_data.pivot_point != 'MEDIAN_POINT'

    def execute(self, context):
        bpy.context.space_data.pivot_point = 'MEDIAN_POINT'
        # @todo Change this to 'BOUDNING_BOX_CENTER' if needed...
        return{'FINISHED'}