Michał Górny <mgo...@gentoo.org> added the comment: > An OSError for a file the OS can read seems a bit off. What is the > accompanying message?
For example: OSError: Invalid data stream (I've just put random string into a file, and opened it as bzip2) > Would something like ValueError("bz2 compressor failed with BZ_DATA_ERROR") > be better? It would be a partial improvement. However, it would also break backwards compatibility with code already catching OSError. It might be better to go with custom exception type derived from OSError to keep existing code working. > Michał, are there precedents or models for this in the other file compression > modules? Python 3.8 has introduced BadGzipFile in gzip module, to replace their OSError. lzma has used LZMAError from day one. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41725> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com