This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mgorny
Recipients mgorny, serhiy.storchaka, terry.reedy
Date 2020-09-12.03:19:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599880757.39.0.980004712646.issue41725@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2020-09-12 03:19:17mgornysetrecipients: + mgorny, terry.reedy, serhiy.storchaka
2020-09-12 03:19:17mgornysetmessageid: <1599880757.39.0.980004712646.issue41725@roundup.psfhosted.org>
2020-09-12 03:19:17mgornylinkissue41725 messages
2020-09-12 03:19:17mgornycreate