3

I am actually able to get this code to work perfectly without error through one environment that I am working through. However, when I write the code (see below) in another environment I get an error:

import tarfile
import numpy as np

texting = []
tar = tarfile.open("home/mk/text.tar.gz", "r:gz")
for member in tar.getmembers():
    f=tar.extractfile(member):
    if f is not None:
        content = f.read()
        texting.append(content)

Just to repeat, I got this to work with no issues at all in my one environment but I get the following error in the other environment:

EOFError: Compressed file ended before the end-of-stream marker was reached

What's the problem and how can I fix this?

bernando_vialli
  • 947
  • 4
  • 12
  • 27

0 Answers0