When I attempt to read from a .gz file line by line with the gzip module in Python, I get a crash:
File "/home/user/path/to/example.py", line 40, in run
for line in handle:
File "/home/user/.conda/envs/py38/lib/python3.10/gzip.py", line 399, in readline
return self._buffer.readline(size)
AttributeError: 'GzipFile' object has no attribute '_buffer'
Here's my code:
import gzip
handle = gzip.open("path/to/file.txt.gz", "w")
for line in handle:
print(line)
I'm using Python 3.10 on Linux.