Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot save pydef-defined class #1

Open
cstjean opened this issue May 5, 2017 · 2 comments
Open

Cannot save pydef-defined class #1

cstjean opened this issue May 5, 2017 · 2 comments

Comments

@cstjean
Copy link
Collaborator

cstjean commented May 5, 2017

@pydef type Store
    __init__(self, a) = (self[:a] = a)
end
save("dummy.jld", "x", Store(10))
> PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL)) <class 'cPickle.PicklingError'>
> PicklingError("Can't pickle <class 'Store'>: attribute lookup __main__.Store failed",)

I don't think anything can be done about it, though.

@stevengj
Copy link
Member

stevengj commented May 5, 2017

Which Python module is Store defined in, if any?

@stevengj
Copy link
Member

stevengj commented May 5, 2017

There is a trick with __reduce__ described on stackoverflow that may be applicable here, though it requires us to define an auxiliary class in the __main__ namespace.

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

No branches or pull requests

2 participants