import sys file_path = 'core/views.py' with open(file_path, 'r') as f: content = f.read() old_code = 'visited_households[key]["voters_at_address"].add(f"{v.first_name} {v.last_name}")' new_code = 'visited_households[key]["voters_at_address"].add((v.id, f"{v.first_name} {v.last_name}"))' if old_code in content: new_content = content.replace(old_code, new_code) with open(file_path, 'w') as f: f.write(new_content) print("Successfully patched core/views.py") else: print("Could not find the target line in core/views.py")