[Bf-python] Problems : range and xrange in NMesh

Willian Padovani Germano wgermano at ig.com.br
Fri Aug 8 23:15:02 CEST 2003


On Fri, 2003-08-08 at 04:16, jms wrote:
> Found on the elysiun python forum:
> this code returns errors:
> 
> import Blender
> selectionList = Blender.Object.getSelected()
> mesh = selectionList[0].getData()
> nParts = 5
> nVerts = len(mesh.verts)
> for p in range(nParts):
>   rangeStart = (p * nVerts)/nParts
>   rangeEnd = ((p+1)*nVerts)/nParts
>   print rangeStart, rangeEnd
> print "-"

Funny error : ).  I added .argv to the sys module and now it works.  I
just added sys.argv[0], which is of course the name of the executable as
you typed to run it: just 'blender' or with a path prepended.  Later if
necessary we can give access to more arguments.  Anyway, I'll commit
this change later.

After the fix, though, Object.getSelected correctly warned that it will
be deprecated, but the msg is followed by gibberish, as when a
terminating '\0' isn't found.  From my tests this seems to be a problem
with PyErr_Warn() in the old 2.2 python version I'm still using here ...

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list