[Bf-python] update list

Campbell Barton ideasman42 at gmail.com
Wed May 18 05:18:12 CEST 2011


All blender strings are supposed to have utf8 compatible, but this was
only enforced recently so its quite possible some older blender files
have latin1 characters in the name.

You need to manually rename any non utf8 names so blender/python can
deal with them.
to find out which, print the object first, before getting its .name attribute.

2011/5/18 Yuniel Castro González <ycastrog at estudiantes.uci.cu>:
> Hello to all.
> I am programming a script, at one point I need to update a list that contains a group of objects, that is, I run:
>
> def find(list, element):          //// find object in list return True, else return False
>    bool = True
>    for i in list:
>        if i.name == element.name:
>            bool = False
>    return bool
>
>
> def update_list():        //// if element of list_of_objects isn't in temp, delete this element
>    bpy.context.scene.update()
>    temp = bpy.context.scene.objects
>
>    for i in list_of_objects:
>        a = find(temp, i)
>        if a:
>            list_of_objects.remove(i)
>
> in short, I want to leave my only objects that are still on the scene, but but I get this error:
>
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 i position 0: invalid continuation byte
>
> what happens???
>
> Thanks in advance.
>
> --
>
>
>
>
>
>
>
>
> Yuniel
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>



-- 
- Campbell



More information about the Bf-python mailing list