Skip to content

Unhandled exception on isinstance(..., JException) #1329

@pulkin

Description

@pulkin

Thanks again for the project!

I have some code to wrap exceptions and send them to parent (python) process. For jpype, I had to add this because JException cannot be serialized:

def wrap_into_traceback(e: BaseException, trim: int = 0) -> traceback.TracebackException:
    ...
    if isinstance(e, JException):
        e = RuntimeError(f"{e.message()}\nTraceback:\n{e.stacktrace()}")

This works most of the time except raising from startJVM(jvmpath="does-not-exist"). Trying to reproduce this in a minimal code, I see this error as OSError: [Errno 0] JVM DLL not found but in the production example it segfaults raises unhandled JPypeException on isinstance (fortunately, can see the traceback). Not sure how to debug this.

terminate called after throwing an instance of 'JPypeException'
Fatal Python error: Aborted
...
Current thread 0x00007f42b216a740 (most recent call first):
File "/home/pulkin/.../something.py", line 87 in wrap_into_traceback

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion on how to use JPype

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions