簡體   English   中英

在 Google-Colab 中提取 tar.gz 文件時遇到問題

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

我正在嘗試提取abc.tar.gz

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

這引發錯誤:

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

我正在嘗試提取abc.tar.gz

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

這引發錯誤:

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

我正在嘗試提取abc.tar.gz

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

這引發錯誤:

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

奇怪的事情,但是 -xf 不再起作用,除非您刪除連字符。 所以新命令看起來像這樣 -

 .tar xf filename.tar.gz

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM