[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

Peter report at bugs.python.org
Fri Apr 7 18:13:25 EDT 2017


Peter added the comment:

A workaround for my use case is even simpler, something like this:

try:
    handle = gzip.open(filename, "rt")
except ValueError:
    # Workaround for Python 2.7 under Windows
    handle = gzip.open(filename, "r")
    
However, even this is troublesome for use in documentation intended to work on Python 2 and 3, over Linux, Mac and Windows.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30012>
_______________________________________


More information about the Python-bugs-list mailing list