Remove object from list when a property is wrong?

How? It is driving me crazy.

I tried

for ob in list:
    if ob['prop'] == 0:
        list = list.remove(ob)


Change “if ob[‘prop’]” to “scene.objects[ob][‘prop’]”. Should fix it.

Might need to have ob converted to a string first (not sure):

I do not understand what you mean with “property is wrong”. Do you mean it has the value “False” or do you mean it does (not) exist or maybe something else?

Btw. When you define a variable with the name “list” you override the build-in type and function “list”. Maybe calling it “obs” is a better choice because it seems you assume it contains ob.

list.remove(ob) already modifies the list, there’s no need to assign it back to list anymore. So just make the last line “list.remove(ob)”

BTW when you have trouble with python types this is usually a good site:

Oh dear, I haven’t seen that, I must be blind :eek:. Now I understand the problem … if that is the problem (maybe there is more).

Yeah that must be the problem. Setting a list to list.remove(x) returns None.