This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve error message for -m option when .py is present
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, pablogsal, rhettinger
Priority: normal Keywords: patch

Created on 2020-03-30 00:02 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19239 merged pablogsal, 2020-03-31 00:31
Messages (2)
msg365286 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-03-30 00:02
I think we can do better than the following:

$ python3.8 -m unicode_math_symbols.py
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8: Error while finding module specification for 'unicode_math_symbols.py' (ModuleNotFoundError: __path__ attribute not found on 'unicode_math_symbols' while trying to find 'unicode_math_symbols.py')

It is a reasonably common mistake to add .py to the module name for module names loaded by the -m command-line launcher.  The error mess is somewhat opaque and not suggestive of what the actual problem is or how to fix it.
msg365376 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-03-31 11:24
New changeset ef67512b40240f765026ad41d60b0c9a6dacd2b9 by Pablo Galindo in branch 'master':
bpo-40108: Improve the error message in runpy when importing a module that includes the extension (GH-19239)
https://github.com/python/cpython/commit/ef67512b40240f765026ad41d60b0c9a6dacd2b9
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84289
2020-09-14 18:48:40brett.cannonsetcomponents: + Library (Lib), - XML
2020-09-12 05:12:45Jay Cee Garciasettype: behavior
components: + XML
2020-03-31 11:24:06pablogsalsetmessages: + msg365376
2020-03-31 11:24:05pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-31 00:31:00pablogsalsetkeywords: + patch
nosy: + pablogsal

pull_requests: + pull_request18596
stage: patch review
2020-03-30 19:13:08rhettingersetnosy: + brett.cannon
2020-03-30 00:02:03rhettingercreate