Skip to content

distinguish "doesn't exist" from "doesn't exist on this Python version" #296

@carljm

Description

@carljm

If a user has their Python version mis-configured, and gets an error like module 'datetime' has no attribute 'UTC', it's not necessarily obvious that the reason for this is that they are on the wrong Python version. It would be nice if we could offer an info context on the diagnostic saying "it exists on other Python versions, but you are running with Python 3.9"

We have basic support for this, but there's more we could do. Quoting a comment below: We now:

  • Report this precise info when you import a stdlib module we have VERSIONS info for (18403, 20908)
  • Mention what version you're on when you fail to access an attribute on a stdlib module we believe does exist in some version/platform (20909)

We do not:

  • Report on attributes of types, optional function arguments, etc.
  • Report the exact version(s) needed for attributes
  • Report the exact platform(s) needed for attributes (or mention the current platform)

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions