`ReadOnlyDict` not pickleable
See original GitHub issueExample:
import pickle
import sacred
cfg = sacred.config.custom_containers.ReadOnlyDict({'foo': {'fizz': 'buzz'}})
cfg_pkl = pickle.dumps(cfg)
cfg_depkl = pickle.loads(cfg_pkl)
Error:
Traceback (most recent call last):
File "sacred_err2.py", line 6, in <module>
cfg_depkl = pickle.loads(cfg_pkl)
File ".../lib/python3.6/site-packages/sacred/config/custom_containers.py", line 232, in _readonly
self.message,
AttributeError: 'ReadOnlyDict' object has no attribute 'message'
I think custom __getstate__ and __setstate__ methods need to be added. I suspect this will also be a problem for some of the other ReadOnlyContainers.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
python - How to make dictionary read-only? - Stack Overflow
Use collections.Mapping e.g. import collections class DictWrapper(collections.Mapping): def __init__(self, data): self.
Read more >Source code for dagster._utils
I'm not sure that there are other ways to provoke this behavior on Unix other ... ReadOnlyDict") # https://docs.python.org/3/library/pickle.html#object.
Read more >Is Pickle the best way to save objects in python? - Quora
No, Pickle should be avoided entirely, as well as serialization libraries which use Pickle internally. It's an extremely dangerous method.
Read more >shelve — Python object persistence — Python 3.11.1 ...
The difference with “dbm” databases is that the values (not the keys!) ... Because the shelve module is backed by pickle , it...
Read more >Release Notes — rustworkx 0.12.1 documentation - Qiskit
For the retworkx-core crate, there will no longer be any releases under that ... the Python mapping protocol and can be used inplace...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.