Ok, I saw similar questions but not exactly the same. And I can't figure out what is really wrong with this python code:
import tarfile
tar_file = tarfile.open('something.tgz', mode="r|gz")
txt_file = tar_file.extractfile('inner.txt')
lines = txt_file.readlines()
txt_file.close()
tar_file.close()
It gives StreamError: seeking backwards is not allowed
due to readlines()
.
But this fact looks strange to me and I try to understand what I miss here.