Skip to content

Raising python errors from Julia functions #357

Closed
@lassepe

Description

@lassepe

Some python package apis require the user the raise specific errors in certain scenarios. For example, Optuna requires the user to conditionally TrialPruned() error. In the current implementation of PythonCall, raising such errors from julia functions does not seem to be possible.

@pyeval `raise optuna.TrialPruned()`

fails with Python: SyntaxError: invalid syntax.

It would be handy to have a function like pyraise to throw such errors manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions