all Python 3shutilfunction
shutil.unregister_archive_format()
archives
Removes a format from make_archive()'s registry — custom or built-in — for the rest of the process.
Syntax
shutil.unregister_archive_format(name)
Even a built-in format like 'zip' can be removed, and the only way back is to register it again. An unknown name raises KeyError — not ValueError or shutil.RegistryError as one might expect. After removal, make_archive with that format raises ValueError 'unknown archive format'.
Examples
import shutil
shutil.register_archive_format('noop', lambda base_name, base_dir, **kw: base_name)
shutil.unregister_archive_format('noop')
print('noop' in dict(shutil.get_archive_formats())) # → False
try:
shutil.unregister_archive_format('noop')
except KeyError as e:
print(repr(e)) # → KeyError('noop')
See also
Open in the full glossarydocs.python.orgReport an inaccuracy