Hi,
I have a rather vague question about your typical workflows to convert python scripts to Julia.
First off all, I’m amazed how nice and performant PyCall works and this has really made converting (and comparing) some of my scripts from Python to Julia quite easy.
My smaller projects are like 500-lines data-evaluation scripts that I have in Python, usually not organized in modules.
Somehow, however, I cannot find “the optimal” workflow to get these scripts converted to Julia.
Last I tried to have much python functionality organized in functions, rewrite the top-level python code in Julia, include and call the functions via pyimport. My idea was to get the Julia script running as quickly (and easily) as possible and then later to convert the python functions one by one.
However, I regluarly run into the situation, that calling a python function throws an exception, and I personally usually cannot read much information from the PyCall exceptions, like:
ERROR: LoadError: PyCall.PyError("\$(Expr(:escape, :(ccall(#= C:\\Users\\joach\\.julia\\packages\\PyCall\\ttONZ\\src\\pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))", PyObject(Ptr{PyCall.PyObject_struct} @0x000000005ca37a60), PyObject(Ptr{PyCall.PyObject_struct} @0x000000003f0ab4c0), PyObject(Ptr{PyCall.PyObject_struct} @0x0000000040196c08))
Usually, the easiest way to get around such hurdles is to rewrite the function in Julia (which is OK, but not the workflow I planned to pursue).
So, while my question is not about this (exemplary) exception, I want to ask
- What is your workflow to convert Python scripts to Julia?
- Are there any tools to debug Python-side errors in Julia, or some easy ways to switch between Julia and Python in such a way that one can find out what the problem on the python side is?
- What would you do, if you encounter a PyCall Exception you cannot understand (given that the function works in Python => must likely be related to the arguments passed).
Looking forward to your input.