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
Is it possible to pickle a class that has the @vsc.randobj decorator? I get a PicklingError when trying to do something like this code below. Using the dill module instead of pickle results in the same error.
Good question, @smccans. Can you share a bit more about your intended usecase? My understanding is that Pickling is used to capture some 'persistent' view of an object that can be stored and/or transported, then 'restored' to its original state. I'll have to give thought to what state, exactly, would need to be stored in order to reconstruct the object.
I will try to read up a bit on Pickling. I suspect there are some hooks that can be used to properly handle corner cases like 'vsc.rand_obj'.
I'm trying to create a vsc.rand_obj and do some randomization on one system and then send that object over the network to one or more other systems. I could just send the seed and do the randomization again on the other systems, but I thought I might get a little better performance by just doing the randomization once.
As a workaround for now, I'm using jsonpickle to encode the vsc.rand_obj as a json string. Then I replace vsc.rand_obj in that json string with the correct module path (__main__ in my original example). This seems to be working so far.
Is it possible to pickle a class that has the @vsc.randobj decorator? I get a PicklingError when trying to do something like this code below. Using the dill module instead of pickle results in the same error.
Running that results in this error:
The text was updated successfully, but these errors were encountered: