Skip to content

Convert JuliaError.__str__ to python error (on branch v1)#744

Open
dpinol wants to merge 1 commit intoJuliaPy:v1from
Avatar-Cognition:conv-error-py
Open

Convert JuliaError.__str__ to python error (on branch v1)#744
dpinol wants to merge 1 commit intoJuliaPy:v1from
Avatar-Cognition:conv-error-py

Conversation

@dpinol
Copy link
Contributor

@dpinol dpinol commented Jan 29, 2026

Strangely, this works fine from PythonCall.jl unit tests... :

try:
    import juliacall
    from juliacall import JuliaError

    juliacall.Main.error()
except JuliaError as e:
    print(e)

..but causes this on my project where I'm migrating to v1:

    jl.fail()
../../../.julia/packages/PythonCall/xZbVY/src/JlWrap/any.jl:479: in __call__
    return self._jl_callmethod($(pyjl_methodnum(pyjlany_call)), args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   juliacall.JuliaError: <exception str() failed>

During handling of the above exception, another exception occurred:
test/julia/test_jl.py:25: in test_pyjlvalues
    print(e)
E   TypeError: __str__ returned non-string (type Jl)

However, I guess it makes sense to convert to python string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant