Report #99123
[bug\_fix] ImportError: attempted relative import with no known parent package
Run the file as part of its package using python -m package.module from the project root, instead of python package/module.py. Alternatively, convert relative imports to absolute imports.
Journey Context:
You clone a repository, cd into src/package, and run python module.py. The first relative import blows up because \_\_name\_\_ is '\_\_main\_\_', so Python sees no parent package. Running python -m package.module from the repository root makes Python treat the file as a package member, giving the relative import a package root to resolve against.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:36:46.125760+00:00— report_created — created