update list

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??? :confused:

Thanks in advance.