Original Post
I can't figure out how to pickle enums that I've defined in C++ then exported to Python with the boost::python enum_ class. I've asked on the C++-SIG at Python.org but no replies. Here's some code: In Python, one of my objects has a BlendType member. When I pickle that object, it gives me this error: I can't find any information on pickling enums, at all. I guess that since Python doesn't have that type, it's unusual to use it. If there's no way to resolve this, is there another way I can achieve the same thing?
enum BlendType { NoBlend, Transparent, Additive };
BOOST_PYTHON_MODULE(Renderer)
{
enum_<BlendType>("BlendType")
.value("NoBlend",NoBlend)
.value("Transparent",Transparent)
.value("Additive",Additive)
;
}
raise PicklingError(
pickle
.
PicklingError
:
Can't pickle <class 'Renderer.BlendType'>: it's not found as __main__.Renderer.BlendType