Closed cloasdata closed 1 year ago
Hi @cloasdata, It does seem the lambda expression is the only thing stopping the pickling of the Chemical object. It seems reasonable to add a dedicated method for that lambda, I agree.
I don't think offering official support for pickling is in the roadmap today because there are lots of features in Thermo that will break it if you use them. Maintaining reliable pickling is a lot of work, and lambdas do have lots of valid uses.
However, I will try to patch it up enough that pickling Chemical works out of the box anyway for the next release.
Sincerely, Caleb
Hi Caleb,
if it have to much impact, then just pass this request because it is not super urgent, as chemicals are working on string keys it is not a problem to have a wrapper/adapter to make them persistent. Anyway, thanks very much! Simon
This is now resolved in the latest version of Thermo!
@CalebBell, first of all thanks a lot for your works. I found that class chemical is not pickle able.
AttributeError: Can't pickle local object 'Chemical.set_TP_sources.<locals>.<lambda>'
At the moment I work arround by removing chemical from state to pickle and later when loaded I construct it again. But it would be a lot easier not think about it at all.
May be this would be somehow possible. Other solution would be to use dill instead.
Thanks!