Set GPU using python script no longer working We have our own render queue manager at work, and i use a python script to set the compute device of each worker to GPU.
However, with 2.79 the script no longer works.

Here is the script i use:

import bpy
bpy.context.user_preferences.system.compute_device_type = 'CUDA'
bpy.context.user_preferences.system.compute_device = 'CUDA_MULTI_2'


Pretty simple right?
But in 2.79 i get the following error:

AttributeError: 'UserPerferencesSystem' object has no attribute 'compute_device_type'


Anyone knows what changed in 2.79 that causes this error?
Changes have been made in the Blender API.
You can retrieve 'compute_device_type' and 'devices' via the cycles addon preferences

prefs = bpy.context.user_preferences.addons['cycles'].preferences
print(prefs.compute_device_type)

for d in prefs.devices:
    print(d.name)