GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve syntax error for invalid imports · Issue #98931 · python/cpython

Improve syntax error for invalid imports #98931

New issue
Copy link
New issue
Copy link
Closed
#98932
Closed
Improve syntax error for invalid imports#98931
#98932
Copy link

Description

@pablogsal
pablogsal
opened on Oct 31, 2022
Issue body actions

Is quite common to type import x from y instead of from y import x. We can easily offer a better error message in this case.

  • PR: gh-98931: Improve error message when the user types 'import x from y' instead of 'from y import x' #98932
  • PR: gh-98931: Add custom error messages to invalid import/from with multiple targets #105985
  • PR: [3.12] gh-98931: Add custom error messages to invalid import/from with multiple targets (GH-105985) #105991
Reacted by Trey Hunner
Reacted by Jelle Zijlstra, Lysandros Nikolaou, Trey Hunner, Charlie Zhao and Nelson Cárdenas Bolaño
Reacted by NamJin Kim and Ewan

Activity

  1. pablogsal
    added 3 commits that reference this issue on Oct 31, 2022

    pythongh-98931: Improve error message when the user types 'import x f…

    d6bb24d

    fixup! pythongh-98931: Improve error message when the user types 'imp…

    207d6e1

    fixup! fixup! pythongh-98931: Improve error message when the user typ…

    fb08d31
  2. pablogsal
    closed this as completedin #98932on Nov 1, 2022
  3. pablogsal
    added a commit that references this issue on Nov 1, 2022

    gh-98931: Improve error message when the user types 'import x from y'…

    395d428
  4. martin-martin commented on Mar 7, 2023

    @martin-martin
    martin-martin
    on Mar 7, 2023
    Contributor
    More actions

    Hi @pablogsal thanks for all your work on error messages. Is a similar situation, but where someone attempts to import more than one name from a module something we'd like to support?

    Currently this situation doesn't benefit from your updates:

    >>> import s, d from this
      File "<stdin>", line 1
        import s, d from this
                    ^^^^
    SyntaxError: invalid syntax

    Just came across it, so I thought I'd leave a note. Thanks again!

  5. pablogsal commented on Mar 7, 2023

    @pablogsal
    pablogsal
    on Mar 7, 2023
    MemberAuthor
    More actions

    Hi @pablogsal thanks for all your work on error messages. Is a similar situation, but where someone attempts to import more than one name from a module something we'd like to support?

    Thanks a lot for the kind words and the suggestion! I will give some though to see how hard is to support this. :)

    Reacted by Martin Breuss
  6. pablogsal
    added 3 commits that reference this issue on Jun 22, 2023

    pythongh-98931: Add custom error messages to invalid import/from with…

    78e213d

    pythongh-98931: Add custom error messages to invalid import/from with…

    594e24f

    gh-98931: Add custom error messages to invalid import/from with multi…

    13237a2
  7. miss-islington
    added a commit that references this issue on Jun 22, 2023

    pythongh-98931: Add custom error messages to invalid import/from with…

    0bb8b06
  8. pablogsal
    added a commit that references this issue on Jun 22, 2023

    [3.12] gh-98931: Add custom error messages to invalid import/from wit…

    c407ef0
  9. bentasker
    added a commit that references this issue on Jun 23, 2023

    pythongh-98931: Add custom error messages to invalid import/from with…

    44bea61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.