Zend certified PHP/Magento developer

Blender python script on Windows server – “cmd error 11”

OS: Windows Server 2019 or 2022

Blender: 2.8.16 or 3.0

If script was run automatically (through Windows Scheduler), then it fails and Windows is throwing CMD error “11”. Issue persists on both background (-b) and GUI run of Blender.

If script was run manually (by double clicking on batch file), then everything is fine.

Part of the script where error is thrown:

video_angles = 60
bpy.data.scenes["Scene"].frame_end = video_angles
gamma = math.pi * 2 / video_angles
for i in range(1, video_angles+1):
    bpy.context.scene.frame_set(i)
    empty.rotation_euler[2] = gamma * i
    empty.keyframe_insert(data_path='rotation_euler', frame=i, index=-1)