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 nadeem.vawda
Recipients maubp, nadeem.vawda
Date 2012-02-11.13:55:56
SpamBayes Score 6.72819e-09
Marked as misclassified No
Message-id <>
The problem here is that gzip.GzipFile does not support text mode, only
binary mode. Unfortunately, its __init__ method doesn't handle unexpected
mode strings sensibly, so you get a confusing error message.

If you need to open a compressed file in text mode in Python 3.2, use

    with io.TextIOWrapper("ex1.sam.gz", "r")) as f:
        line = f.readline()

In 3.3, it would be nice for to do this transparently when mode
is "rt"/"wt"/"at". However, binary mode will still need to be the default
(for modes "r", "w" and "a"), to ensure backward compatibility.

In the meanwhile, I'll add a note to the documentation about this
limitation, and fix GzipFile.__init__ to produce a more sensible error
Date User Action Args
2012-02-11 13:55:57nadeem.vawdasetrecipients: + nadeem.vawda, maubp
2012-02-11 13:55:56nadeem.vawdasetmessageid: <>
2012-02-11 13:55:56nadeem.vawdalinkissue13989 messages
2012-02-11 13:55:56nadeem.vawdacreate