PyCall.jl
PyCall.jl copied to clipboard
Prettyerrors
On master the following snippet:
using PyCall
py"""
def raise_multi_line_error():
raise Exception("1\n2\n3\n4\n")
"""
py"raise_multi_line_error"()
gives
ERROR: LoadError: PyError ($(Expr(:escape, :(ccall(#= /home/jan/.julia/dev/PyCall/src/pyfncall.jl:43
=# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'Exception'>
Exception('1\n2\n3\n4\n')
File "/home/jan/.julia/dev/PyCall/src/pyeval.jl", line 2, in raise_multi_line_error
const Py_file_input = 257
This is hard to read. See also #843 . With this PR it becomes:
ERROR: LoadError: PyError:
1
2
3
4
File "/home/jan/.julia/dev/PyCall/src/pyeval.jl", line 2, in raise_multi_line_error
const Py_file_input = 257
Is there interest in this PR?
@stevengj can you briefly comment if there is interest in this PR? So I know if I should polish / redesign / abandon it.