You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pyconvert_add_rule must be executed before using pyimport in __init__() #500
It took me ages to figure out why the following did not manage to add a conversion rule, despite it following the documentation here and here
const mylib = pynew()
function __init__()
pycopy!(mylib, pyimport("mylib")
pyconvert_add_rule(".......", T, _func)
end
It seems swapping the order solves the issue
const mylib = pynew()
function __init__()
pyconvert_add_rule(".......", T, _func)
pycopy!(mylib, pyimport("mylib")
end
i.e. the conversion rule must be added before pyimport is called. I guess it is too late to add the rules once the python executable has started? Perhaps this should be clarified in the documentation?
No that's a bug, you should be able to add rules at any point. What version of PythonCall are you on? Please post some complete reproducing code which demonstrates the issue.
Thanks for closing. I have some vague recollection that we fixed a bug a while back to do with cacheing these conversion rules - maybe that fixed your issue.
Activity
cjdoris commentedon May 20, 2024
No that's a bug, you should be able to add rules at any point. What version of PythonCall are you on? Please post some complete reproducing code which demonstrates the issue.
johroj commentedon Sep 10, 2024
I am certain I verified the bug multiple times before filing the bug report, but I cannot reproduce the issue, unfortunately.
cjdoris commentedon Sep 10, 2024
Thanks for closing. I have some vague recollection that we fixed a bug a while back to do with cacheing these conversion rules - maybe that fixed your issue.