Skip to content

How do I catch (nimpy.KeyError) in Python? #207

@yuyamashiro

Description

@yuyamashiro

I want to except nimpy.KeyError.
However I can't do it.

Example:

try:
        # Some code: call Nim by nimpy
    except KeyError as e:
        # I  can't catch nimpy.KeyError
        print("key error")
        print(e, type(e))
    except Exception as e:
        print("Unknown")
        print(e, type(e))
        raise e

Output

Unknown
Unexpected error encountered: key not found: city <class 'nimpy.KeyError'>
nimpy.KeyError: ...

How do I catch nimpy.KeyError?

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