[Bf-committers] SystemError when using simple mesh commands in scripts started from the command line...

Martin Poirier theeth at yahoo.com
Fri Nov 6 18:39:22 CET 2009


I know, my point is you can't do that using command line scripts.
Which explains the error he was getting.

Martin

--- On Fri, 11/6/09, Roger Wickes <rogerwickes at yahoo.com> wrote:

> From: Roger Wickes <rogerwickes at yahoo.com>
> Subject: Re: [Bf-committers] SystemError when using simple mesh commands in scripts started from the command line...
> To: "bf-blender developers" <bf-committers at blender.org>
> Received: Friday, November 6, 2009, 12:12 PM
> i think OP just wanted to add a cube
> to the scene....
> 
>  ----------------
> Sent by Roger Wickes for intended recipient. If you are not
> the intended recipient, please delete this message and
> contact Mr. Wickes immediately.
> 
> 
> 
> 
> ________________________________
> From: Martin Poirier <theeth at yahoo.com>
> To: bf-blender developers <bf-committers at blender.org>
> Sent: Fri, November 6, 2009 9:57:22 AM
> Subject: Re: [Bf-committers] SystemError when using simple
> mesh commands in scripts started from the command line...
> 
> --- On Fri, 11/6/09, Dietrich Bollmann <diresu at web.de>
> wrote:
> 
> > From: Dietrich Bollmann <diresu at web.de>
> > Subject: [Bf-committers] SystemError when using simple
> mesh commands in scripts started from the command line...
> > To: bf-committers at blender.org
> > Received: Friday, November 6, 2009, 9:10 AM
> > Hi,
> > 
> > The following simple script doesn't work when used
> from the
> > command
> > line:
> > 
> > ---
> > import bpy
> > bpy.ops.mesh.primitive_cube_add()
> > ---
> > 
> > Here the error message:
> > 
> > ---
> > blender -P /tmp/cube.py
> > found bundled
> > python:
> >
> /home/dietrich/blendev/bazaar/blender/working/trunk/install/linux2/.blender/python
> > Traceback (most recent call last):
> >   File "/tmp/cube.py", line 2, in
> <module>
>>    bpy.ops.mesh.primitive_cube_add()
> >   File
> >
> "/home/dietrich/blendev/bazaar/blender/working/trunk/blender/release/scripts/modules/bpy_ops.py",
> > line 172, in __call__
> >     return op_call(self.idname(),
> C_dict, kw)
> > SystemError: bpy.__ops__.call: operator poll()
> function
> > failed, context
> > is incorrect
> > *bpy stats* - tot exec: 78,  tot run: 0.0132sec,
> 
> > average run:
> > 0.000170sec,  tot usage 0.5393%
> > 
> > Blender quit
> > ---
> > 
> > Should I file a bug report - or is this error caused
> by
> > myself
> > misunderstanding the command?
> 
> There might be a bit of both, but the are definitely some
> bugs in the API.
> 
> First, the context parameter passed to the operator call
> (like 'INVOKE_AREA', 'EXEC_SCREEN', ...) is only used for
> the calling function, not for the polling function.
> 
> So if the poll function requires a specific context, it
> will never work correctly when called from the command
> line.
> 
> That can be fixed by forcing a proper context like this:
> 
> -------------
> import bpy
> bpy.ops.mesh.primitive_cube_add("EXEC_AREA", {"scene":
> bpy.data.scenes[0]})
> -------------
> 
> But then the operator fails silently (fun) because there is
> no window defined in the context (null check in
> wm_operator_call_internal) and that cannot be overwritten in
> Python (CTX_wm_window accesses the windowmanager directly,
> it doesn't try a lookup).
> I'm not sure if that's NULL because the command line script
> is run before the wm is initialized or because it's using a
> fake python context (probably the former).
> 
> That also means running operators when blender is in
> background mode with always fail.
> 
> So yeah, in conclusion, the API is nowhere near ready and
> still has serious problems.
> 
> As a side note, it would be nice if polling errors could
> tell what's wrong with the current context.
> 
> Martin
> 
> 
>      
> __________________________________________________________________
> Looking for the perfect gift? Give the gift of Flickr! 
> 
> http://www.flickr.com/gift/
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
> 
> 
> 
>       
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
> 


      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com


More information about the Bf-committers mailing list