import json
def clean_widgets_from_notebook(input_path, output_path):
with open(input_path, 'r', encoding='utf-8') as f:
notebook = [Link](f)
if 'widgets' in [Link]('metadata', {}):
print(" 🧹 Removing corrupted widget metadata...")
del notebook['metadata']['widgets']
with open(output_path, 'w', encoding='utf-8') as f:
[Link](notebook, f, indent=2)
print(f" ✅ Cleaned notebook saved to: {output_path}")
# Example usage:
clean_widgets_from_notebook("[Link]", "[Link]")