Skip to content

python.raise_exception() docs give wrong signature #1261

@rsyring

Description

@rsyring

Describe the bug

I believe the example from the docs for this function is wrong:

python.raise_exception(
    name="Raise NotImplementedError exception",
    exception=NotImplementedError,
    message="This is not implemented",
)

It produces the error:

    [@local] Unexpected error in Python callback: TypeError('NotImplementedError() takes no keyword arguments',)

It should actually be:

python.raise_exception(
    NotImplementedError,
    "This is not implemented",
    name="Raise NotImplementedError exception",
)

Meta

    System: Linux
      Platform: Linux-6.8.0-51-generic-x86_64-with-glibc2.39
      Release: 6.8.0-51-generic
      Machine: x86_64
    pyinfra: v3.1.1
      click: v8.1.3
      configparser: v7.1.0
      distro: v1.9.0
      gevent: v24.11.1
      jinja2: v3.1.2
      packaging: v24.2
      paramiko: v3.5.0
      pytest: v7.4.0
      pytest: v7.4.0
      python-dateutil: v2.8.2
      pywinrm: v0.5.0
      setuptools: v75.8.0
      typeguard: v4.4.1
      typing-extensions: v4.12.2
      wheel: v0.40.0
    Executable: /home/rsyring/.local/pipx/venvs/kilo/bin/pyinfra
    Python: 3.11.7 (CPython, GCC 13.2.0)

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