William Tisäter added the comment:
I'm not sure if this is a suitable feature in `make_archive()`, it would only
introduce a more expensive and ugly lookup. Using this method with a
pre-defined filename including extension must be rare. If you really want this
behaviour, I would prefer having this helper instead:
def make_archive(filename, **kwargs):
for fmt, ext, info in shutil.get_unpack_formats():
if not filename.lower().endswith(tuple(ext)):
continue
return shutil.make_archive(filename[:-len(ext)], fmt, **kwargs)
raise ValueError("Unknown archive format: %s" % filename)
Not sure what version you are using, `get_unpack_formats()` got introduced in
3.2.
----------
nosy: +tiwilliam
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19214>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com