for key, value in object_dict.iteritems():
if key in field_labels:
object_dict[field_labels[key]] = object_dict[key]
del object_dict[key]
The code above loops through a dictionary and makes changes to it, hence python raises "RuntimeError: dictionary changed size during iteration"
Possible solution:
loop_dict = object_dict.copy()
for key, value in loop_dict.iteritems():
if key in field_labels:
object_dict[field_labels[key]] = object_dict[key]
del object_dict[key]
The code above loops through a dictionary and makes changes to it, hence python raises "RuntimeError: dictionary changed size during iteration" Possible solution: