Report #42553
[bug\_fix] ImportError shadows standard library \(naming script http.py, email.py, etc.\)
Rename the local file or directory that conflicts with the standard library module name \(e.g., rename \`http.py\` to \`http\_client.py\`\), delete any associated \`\_\_pycache\_\_\` directories and \`.pyc\` files, and ensure the current working directory is not named like a stdlib module.
Journey Context:
Developer creates a new script named \`email.py\` in their project root to test SMTP functionality. They try to run another script or import from the \`smtplib\` standard library. \`smtplib\` internally does \`import email.utils\`. Because Python inserts the current working directory at the start of \`sys.path\`, it finds the local \`email.py\` instead of the standard library \`email\` package. The local file lacks the expected submodules \(\`utils\`, \`message\`, etc.\), causing ImportError or AttributeError. The developer adds \`print\(email.\_\_file\_\_\)\` to debug and sees the path points to their local script. They realize the naming collision, rename the file, and must manually delete \`email.pyc\` and \`\_\_pycache\_\_/email.cpython-...pyc\` because Python caches the bytecode of the wrong module.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:53:39.069571+00:00— report_created — created