Open hubert-associates opened 8 months ago
This in Julia
julia> try
@pyexec "raise ValueError('foo')"
catch err
if err isa PyException && pyisinstance(err, pybuiltins.ValueError)
@info "handling a ValueError"
else
rethrow()
end
end
[ Info: handling a ValueError
is roughly equivalent to this in Python
>>> try:
... raise ValueError('foo')
... except ValueError as err:
... print('handling a ValueError')
...
handling a ValueError
Sincere thanks for the quick response. Tricky/frustrating to arrive here without this user's guide pattern ....
Using PythonCall.jl, how do I best handle python exception patters such as the following python:
xref stackoverflow