79717910

Date: 2025-07-28 21:48:07
Score: 1.5
Natty:
Report link

You use method .copy(), but string type objects has no such method (unlike lists or some others for example). You can simply write: metadata = raw_metadata because strings are immutable. Maybe, you wait raw_metadata got other type but string - it means you are wrong about the type you get by the lines raw_metadata = doc.get('metadata', {}) or raw_metadata = doc[1] if len(doc) > 1 else {} . Also if you use metadata = {} and the next reinit it by metadata = raw_metadata.copy() it will get a type of the last initiation. You can always check all types of your variables using print(type(your_variable) or use this check in code like if type(your_variable) == ...

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Паша Иден