Thank you Bassam.<div><br></div><div>I will look into this later! Now i feel hopefull i will solve thia problem. :)</div><div><br></div><div>Ulf<br><br>On Friday, June 10, 2016, Bassam Kurdali <<a href="mailto:bassam@urchn.org">bassam@urchn.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi Ulf, quick answer:</div><div><br></div><div>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),</div><div>but:</div><div>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:</div><div>- You can override context: <a href="https://www.blender.org/api/blender_python_api_2_77_0/bpy.ops.html" target="_blank">https://www.blender.org/api/blender_python_api_2_77_0/bpy.ops.html</a></div><div>- Set your code to run within an operator, or from a panel, and then execute it from the sequencer</div><div>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.</div><div>Cheers</div><div>Bassam</div><div>On Fri, 2016-06-10 at 20:26 +0200, Ulf Enhörning wrote:</div><blockquote type="cite"><div dir="ltr"><p style="margin-bottom:0cm" lang="sv-SE"><font face="Verdana, sans-serif">Hello,
I am developing <span>Python</span> scripts that use the </font><font face="Verdana, sans-serif"><b>bpy.ops.sequencer</b></font><font face="Verdana, sans-serif">. Several of the operators
give the following error message:</font></p>
<p style="margin-bottom:0cm"><font face="Verdana, sans-serif"><b>File
“</b></font><a><font color="#000000"><font face="Verdana, sans-serif"><span lang="sv-SE"><span style="text-decoration:none"><b>C:\Program</b></span></span></font></font></a><font face="Verdana, sans-serif"><span lang="sv-SE"><b>
files\Blender Foundation\Blender\2.77\scripts\modules\bpy\ops.py,
line 189, in __cal__</b></span></font></p>

<p style="margin-bottom:0cm" lang="sv-SE"><font face="Verdana, sans-serif"><b>ret
= op_call(self.idname_py(), None, kw)</b></font></p>

<p style="margin-bottom:0cm" lang="sv-SE"><font face="Verdana, sans-serif"><b>RuntimeError:
Operator bpy.ops.sequencer.effect_strip_add.poll() failed, context is
incorrect</b></font></p>
<p style="margin-bottom:0cm" lang="sv-SE"><font face="Verdana, sans-serif"><b>Error:
<span>Python</span> script fail, look in the console for now...</b></font></p>

<p style="margin-bottom:0cm" lang="sv-SE"><font face="Verdana, sans-serif">Here
are a few of the operators that yield the above error message:</font></p>
<p style="margin-bottom:0cm" lang="sv-SE">
</p>
<p style="margin-bottom:0cm"><font face="Verdana, sans-serif"><span lang="sv-SE">bpy.ops.sequencer.</span><span lang="sv-SE"><b>effect_strip_add(type='CROSS')</b></span></font></p><font face="Verdana, sans-serif"><span lang="sv-SE"><span style="font-weight:normal">bpy.ops.sequencer</span></span><span lang="sv-SE"><b>.duplicate(mode='TRANSLATION')</b></span></font><font face="Verdana, sans-serif"><span lang="sv-SE"><span style="font-weight:normal"><br>bpy.ops.sequencer</span></span><span lang="sv-SE"><b>.paste()</b></span></font><font face="Verdana, sans-serif"><span lang="sv-SE"></span></font><font face="Verdana, sans-serif"><span lang="sv-SE"><span style="font-weight:normal"><br>bpy.ops.sequencer</span></span><span lang="sv-SE"><b>.select()</b></span></font><font face="Verdana, sans-serif"><span lang="sv-SE"><span style="font-weight:normal"><br>bpy.ops.sequencer</span></span><span lang="sv-SE"><b>.next_edit()</b></span></font><font face="Verdana, sans-serif"><span lang="sv-SE"></span></font>

<p style="margin-bottom:0cm;font-weight:normal"><font face="Verdana, sans-serif"><span lang="sv-SE">I
would be very grateful to any suggestions that could help me solv</span><span lang="en-CA">e</span><span lang="sv-SE">
this so I can be on my way in writing interesting scripts!</span></font></p>
<p style="margin-bottom:0cm;font-weight:normal" lang="sv-SE"><font face="Verdana, sans-serif">Sincerely,
Ulf Enhörning</font></p></div>
<pre>_______________________________________________
Bf-python mailing list
<a href="javascript:_e(%7B%7D,'cvml','Bf-python@blender.org');" target="_blank">Bf-python@blender.org</a>
<a href="https://lists.blender.org/mailman/listinfo/bf-python" target="_blank">https://lists.blender.org/mailman/listinfo/bf-python</a>
</pre></blockquote></div></blockquote></div><br><br>-- <br>Ulf Enhörning<br><a href="http://summerclouds.com">summerclouds.com</a><br><br>