Skip to content

E402: Add "with" to allowed_try_keywords #833

Description

@EricCousineau-TRI

For certain imports, it would be nice to scope warning filters (e.g. in RobotLocomotion/drake#10527).

In my case, I want to do something like:

import warnings

with warnings.catch_warnings():
    warnings.filterwarnings(
        "ignore", category=ImportWarning,
        message="can't resolve package from __spec__")
    import meshcat

Without mods to 2.3.1, it throws a warning about this. If I add "with" to the allowed keywords, then it works.

Would it be possible to add this keyword?

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions