I think the problem is the order that scripts run at launch. Cycles is an addon -> addons are loaded after startup folder scripts.
Perhaps some way to delay until blender is finished launching, make sure cycles is loaded/activated, then try your line of code line?
I have my prefs set up in a startup script, all works except the enabling cuda part.
heres that prefs.py:
Code: Select all
AUTHOR = 'dust'
prefs = context.user_preferences
filepaths = prefs.filepaths
filepaths.font_directory = "/Library/Fonts/"
filepaths.animation_player_preset = "DJV"
filepaths.image_editor = '/Applications/GIMP.app'
filepaths.texture_directory = '/Users/dust/Pictures/texture/'
filepaths.render_output_directory = '/Users/dust/Desktop/'
filepaths.show_thumbnails = True
inputs = prefs.inputs
inputs.use_mouse_continuous = True
view = prefs.view
view.show_splash = False
view.use_auto_perspective = True
system = prefs.system
system.compute_device_type = 'CUDA'
system.author = AUTHOR
edit = prefs.edit
edit.use_enter_edit_mode = True
edit.object_align = 'VIEW'
if not bpy.context.user_preferences.system.author:
print('setting preferences for author:',AUTHOR)
if __name__ == "__main__":