1 | initial version |
Python does not know how to save the state of the generator object. You need to define methods to "pickle" and "unpickle" your object, i.e., save a persistent state and read it back.
There is some documentation for this in the pickle section of the Python documentation. Especially this section on pickling normal class instances is relevant.
Essentially, you need to define two methods __getstate__()
and __setstate__(state)
.