export_pickle¶
-
menpo.io.
export_pickle
(obj, fp, overwrite=False)[source]¶ Exports a given collection of Python objects with Pickle.
The
fp
argument can be either a str or any Python type that acts like a file. Iffp
is a path, it must have the suffix .pkl or .pkl.gz. If .pkl, the object will be pickled using Pickle protocol 2 without compression. If .pkl.gz the object will be pickled using Pickle protocol 2 with gzip compression (at a fixed compression level of 3).Note that a special exception is made for pathlib.Path objects - they are pickled down as a pathlib.PurePath so that pickles can be easily moved between different platforms.
Parameters: - obj (
object
) – The object to export. - fp (str or file-like object) – The string path or file-like object to save the object at/into.
- overwrite (bool, optional) – Whether or not to overwrite a file if it already exists.
Raises: ValueError
– File already exists andoverwrite
!=True
ValueError
–fp
is a file-like object andextension
isNone
ValueError
– The provided extension does not match to an existing exporter type (the output type is not supported).
- obj (