On this page
pickle.PicklingError
Prev: pickle.Pickler | Up: pickle | Next: pickle.Unpickler
Rel: pickle.dump, pickle.dumps, pickle.load, pickle.loads
Ref: docs.python.org โ pickle.PicklingError
Tags: #public #python3 #stdlib #pickle
Import
import pickle
from pickle import PicklingError
Signature & Overview
pickle.PicklingError(...)
pickle.PicklingError class.
Methods & Attributes
PicklingError.add_note(self, note, /)โ Add a note to the exceptionPicklingError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import pickle
try:
pickle.dumps(lambda x: x)
except (pickle.PicklingError, AttributeError):
assert True
Gotchas
- Lambdas, nested local functions, open files, and locks cannot be pickled.
REPL Inspect
from pickle import PicklingError
help(PicklingError)
Linked from
Related notes
- tuts/python3/stdlib_module/pickle/Pickler Linked here; links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/Unpickler Linked here; links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/pickle/dump Linked here; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/dumps Linked here; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/load Linked here; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/loads Linked here; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/PickleBuffer shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/PickleError shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/UnpicklingError shared tags: #pickle, #stdlib