| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
When running a package with 'python -m mypackage', sys.argv[0] points to mypackage/__main__.py. Previously this caused the usage/help output to show '__main__.py' as the command name instead of the actual package name. This fix extracts the package name from the parent directory when the script name is '__main__.py', applied in both fire/__main__.py (for python -m fire) and fire/core.py (for fire.Fire() calls).
| Back | FazBrowse Home | New Git URL |
Summary
When running a package with python -m mypackage, sys.argv[0] points to mypackage/__main__.py. Previously this caused the usage/help output to show __main__.py as the command name instead of the actual package name.
Changes
This fix extracts the package name from the parent directory when the script name is __main__.py, applied in two places:
Testing
Related Issue
Fixes #76: "Use package name when main.py is used"