[Bf-python] bpy.ops.sequencer??

Bassam Kurdali bassam at urchn.org
Fri Jun 10 21:52:57 CEST 2016


Hi Ulf, quick answer:
Operators' poll() function are looking for specific properties in
bpy.context ; it's impossible to know which without looking at the
actual code for the specific operator's poll() function (for example,
mesh editing operators might check that you're in edit mode),
but:
It's highly probably that in this case the failure is in the space type
- these operators don't run outside of a sequencer window, so if you're
running this from e.g. a python console or text editor, it won't work.
Some options:
- You can override context: https://www.blender.org/api/blender_python_
api_2_77_0/bpy.ops.html
- Set your code to run within an operator, or from a panel, and then
execute it from the sequencer
Personally I'd do the later; overriding context has not been too
reliable for me. Or, if possible, avoid using the operators altogether
in my code.
Cheers
Bassam
On Fri, 2016-06-10 at 20:26 +0200, Ulf Enhörning wrote:
> Hello, I am developing Python scripts that use the bpy.ops.sequencer.
> Several of the operators give the following error message:
> File “C:\Program files\Blender
> Foundation\Blender\2.77\scripts\modules\bpy\ops.py, line 189, in
> __cal__
> ret = op_call(self.idname_py(), None, kw)
> RuntimeError: Operator bpy.ops.sequencer.effect_strip_add.poll()
> failed, context is incorrect
> Error: Python script fail, look in the console for now...
> Here are a few of the operators that yield the above error message:
> bpy.ops.sequencer.effect_strip_add(type='CROSS')
> bpy.ops.sequencer.duplicate(mode='TRANSLATION')
> bpy.ops.sequencer.paste()
> bpy.ops.sequencer.select()
> bpy.ops.sequencer.next_edit()
> I would be very grateful to any suggestions that could help me solve
> this so I can be on my way in writing interesting scripts!
> Sincerely, Ulf Enhörning
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> https://lists.blender.org/mailman/listinfo/bf-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160610/a00fae12/attachment.html>


More information about the Bf-python mailing list