These are chat archives for spyder-ide/public
spyder-kernels, Python, and your operating system are you running? Does the path/name you're trying to save to have any special or non-ASCII characters? Is it writable? Can you try opening a new Console, creating e.g. a simple list and trying to save your environment to your home directory, to try to isolate other causes? If that works but saving your current env doesn't can you isolate what might be the issue by using
delon each object in turn from your env and seeing if it starts working, and by trying to save it to a different path? Thanks!
Exclude unsupported data typeswas unchecked in the Variable Explorer options menu ("gear" icon), and at least one Python module (
pandas, etc) was present in the namespace. Therefore, if you either deselect this option, or temporarily
delany objects of type
module(and just re-import them again after you've saved your workspace), you should be alright.
delon any custom classes, "unusual" objects, etc. which are likely to be the cause rather than common dicts, lists, arrays, dataframes, etc and let us know what fixes it so we can be aware on our end.
Exclude Unsupported Data Types?
Exclude Unsupported Data Types can be checked or unchecked, I don't think that this problem is related to this fact.
If you still experienced the problem with it checked, this implies the issue was fact due to a common data type that is considered "supported" (Python collections, numpy arrays, pandas dataframes, etc) which is unfortunate; it would have been beneficial to know what this was.
In any case; while Spyder can't yet serialize everything, it isn't supposed to just fail silently in such situations, and at least give you a clear error message as to what happened and ideally, just skip the unserializable objects entirely wit h a warning messaging listing what was not saved. Furthermore, a likely cause of this error (attempting to pickle module objects) can be fixed by automatically filtering them from the namespace before saving, since they cannot be serialized and a user would rarely, if ever want to actually save them as part of their session. I've opened a new Issue to this effect, spyder-ide/spyder-kernels#75 , which I should be able to implement soon. Therefore, if this happens again once that is implemented, modules will be skipped, only the objects which Spyder cannot serialize will not be saved, and it should pop up a warning message stating exactly what not could be saved.
Longer term, there are multiple facets to improving this: including an
Exclude Python modules filter to the options menu (that would explicitly hide these, without affecting all arbitrary/custom types like
Hide 'unsupported' variable types), as discussed in spyder-ide/spyder# 1676 ; adding a configurable name/type blacklist to the session save feature, as discussed in spyder-ide/spyder#7257 ; moving to a more comprehensive serialization library and/or a higher pickle protocol, etc. However, that change will get us most of the way there in terms of fixing the core unable to serialize issues.