TypeError: cannot pickle 'generator' object
Euraxluo opened this issue · 5 comments
Euraxluo commented
code:
from rocksdict import Rdict
path = str("./test_dict")
db = Rdict(path)
def f(a, b):
for n in range(a):
yield b + b[-1] * n
gen = f(4, 'ay')
x = next(gen)
db['gx'] = gen
error:
TypeError: cannot pickle 'generator' object
thinking:
It should be the cause of pickling, but it doesn't fit the readme description of being able to store anything
Euraxluo commented
Default mode, which allows storing int, float, bool, str, bytes, and other python objects.
Congyuwang commented
Right, only python objects that can be pickled. But you might also use raw_mode to store objects in custom encoding.
Euraxluo commented
in history commit :value: int, float, bool, str, bytes and anything that supports pickle.
Euraxluo commented
i will try,thx
Congyuwang commented
Updated the readme, adding (with Pickle
) to clarify this problem.