Auto Run unable to change context

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

vinniyo
Posts: 7
Joined: Thu Dec 20, 2012 9:12 am

Auto Run unable to change context

Postby vinniyo » Thu Dec 20, 2012 9:27 am

Hi,
I'm very stumped and I assume that there isn't a fix for this so I'm looking for some kind of work around. It seems as if the Scene maybe loaded after the python script is autorun both by the command line " -P main.py" and also having register script checked. Certain script commands run fine. Eg:

bpy.ops.sequencer.delete()
bpy.ops.sequencer.sound_strip_add(filepath="C:\\par5.wav")
bpy.context.scene.frame_end = soundl

But selecting Modes or area types throw an error. Eg:

bpy.context.area.type = "SEQUENCE_EDITOR"
bpy.ops.object.mode_set(mode='POSE')
bpy.ops.pose.select_all(action='DESELECT')

Note: The script works fine if I click Run Script within Blender.
The purpose of this project is to automate random movements for the rig in a large video sequence. Blinks, hand gestures, etc.
Any help would be greatly appreciated. Thank you!

vinniyo
Posts: 7
Joined: Thu Dec 20, 2012 9:12 am

Re: Auto Run unable to change context

Postby vinniyo » Thu Dec 20, 2012 9:46 am

bpy.context.area.type = "SEQUENCE_EDITOR" give
AttributeError: 'NoneType' object has no attribute 'type'


Return to “Python”

Who is online

Users browsing this forum: No registered users and 2 guests