Report #100963
[bug\_fix] ModuleNotFoundError: No module named 'json' \(or any stdlib module\) after creating a local file named json.py
Rename the shadowing file \(e.g., json.py → data\_json.py\) and delete its compiled \_\_pycache\_\_/json.pyc, then run again. Never name user modules after stdlib or installed packages.
Journey Context:
You write a quick script to dump some config and name it json.py. Later, another file in the same directory does import json and immediately dies with ModuleNotFoundError: No module named 'json'. Confusingly, the standard library clearly has json. You check sys.path and the stdlib is there. Then you realize Python's module search path searches the script's directory first; your json.py is being imported instead of the standard library's json. Because your json.py doesn't expose load/dump/loads, downstream code that calls json.dumps crashes. The fix is to rename the shadowing module and remove its .pyc cache so Python doesn't keep resolving json to the stale bytecode.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T04:45:28.748870+00:00— report_created — created