Constants cannot be pickled
See original GitHub issue$ python
Python 3.7.3 (default, Jun 20 2019, 09:05:27)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import astropy
>>> astropy.__version__
'3.2.1'
>>> from astropy.constants import GM_sun
>>> import pickle
>>> pickle.loads(pickle.dumps(GM_sun))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/juanlu/.pyenv/versions/poliastro37/lib/python3.7/site-packages/astropy/constants/constant.py", line 37, in wrapper
name_lower = self.name.lower()
AttributeError: 'NoneType' object has no attribute 'lower'
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Establishing why an object can't be pickled - Stack Overflow
I would use dill , which has tools to investigate what inside an object causes your target object to not be picklable. See...
Read more >pickle — Python object serialization — Python 3.11.1 ...
The pickle module keeps track of the objects it has already serialized, so that later references to the same object won't be serialized...
Read more >pickle — Python object serialization - GeeksforGeeks
Pickling : It is a process where a Python object hierarchy is converted into a byte stream. ... Constants provided by the pickle...
Read more >Python Pickle Module for saving Objects by serialization
Pickling is the serializing and de-serializing of python objects to a byte stream. Unpicking is the opposite. You may hear this methodology called...
Read more >12.1. pickle — Python object serialization - Read the Docs
marshal cannot be used to serialize user-defined classes and their instances. pickle can save and ... The pickle module provides the following constants:....
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 FreeTop 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
Top GitHub Comments
Sure, I agree with going on with the conversation on the original one
All I can say for right now is that #5719 notes that all the pickle tests on constants are set to xfail and that this is something we should investigate. At least that tells us that the inability to pickle constants is not a new thing. I am unsure whether this should be considered a bug or a feature.