Shahriar Zaman
Shahriar Zaman

Reputation: 938

Facing problem when extracting tar.gz file in Google-Colab

I am trying to extract abc.tar.gz

import tarfile
tar = tarfile.open('abc.tar.gz')
tar.extractall()

this raise error:

EOFError                                  Traceback (most recent call last)

<ipython-input-7-a3ea34501364> in <module>()
      1 import tarfile
      2 tar = tarfile.open('/content/drive/My Drive/Colab Notebooks/abc.tar.gz')
----> 3 tar.extractall()

7 frames

/usr/lib/python3.6/gzip.py in read(self, size)
    480                 break
    481             if buf == b"":
--> 482                 raise EOFError("Compressed file ended before the "
    483                                "end-of-stream marker was reached")
    484 

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

Upvotes: 3

Views: 11410

Answers (3)

Parth Sharma
Parth Sharma

Reputation: 21

weird thing, but -xf doesn't work anymore, unless you remove the hyphen. So the new command looks something like this -

!tar xf filename.tar.gz

Upvotes: 0

Noman Tanveer
Noman Tanveer

Reputation: 335

Current way is:

!tar -xf abc.tar.gz

Upvotes: 3

can
can

Reputation: 419

You can use

!tar xvzf abc.tar.gz

Upvotes: 7

Related Questions