Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for -m option when .py is present #84289

Closed
rhettinger opened this issue Mar 30, 2020 · 2 comments
Closed

Improve error message for -m option when .py is present #84289

rhettinger opened this issue Mar 30, 2020 · 2 comments
Labels
3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

BPO 40108
Nosy @brettcannon, @rhettinger, @pablogsal
PRs
  • bpo-40108: Improve the error message in rumpy when importing a module including the extension #19239
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-03-31.11:24:05.750>
    created_at = <Date 2020-03-30.00:02:03.765>
    labels = ['3.8', 'type-bug', 'library', '3.9']
    title = 'Improve error message for -m option when .py is present'
    updated_at = <Date 2020-09-14.18:48:40.197>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2020-09-14.18:48:40.197>
    actor = 'brett.cannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-03-31.11:24:05.750>
    closer = 'pablogsal'
    components = ['Library (Lib)']
    creation = <Date 2020-03-30.00:02:03.765>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40108
    keywords = ['patch']
    message_count = 2.0
    messages = ['365286', '365376']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'rhettinger', 'pablogsal']
    pr_nums = ['19239']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40108'
    versions = ['Python 3.8', 'Python 3.9']

    @rhettinger
    Copy link
    Contributor Author

    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.

    @rhettinger rhettinger added 3.8 only security fixes 3.9 only security fixes labels Mar 30, 2020
    @pablogsal
    Copy link
    Member

    New changeset ef67512 by Pablo Galindo in branch 'master':
    bpo-40108: Improve the error message in runpy when importing a module that includes the extension (GH-19239)
    ef67512

    @JayCeeGarcia JayCeeGarcia mannequin added topic-XML type-bug An unexpected behavior, bug, or error labels Sep 12, 2020
    @brettcannon brettcannon added stdlib Python modules in the Lib dir and removed topic-XML labels Sep 14, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants