question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
astrojuanlucommented, Aug 20, 2019

is everyone okay with closing this one

Sure, I agree with going on with the conversation on the original one

1reaction
stargasercommented, Aug 19, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found