problem to uncompreess .tar file
Posted: Sat Apr 10, 2021 8:21 pm
Hi! i have a problem when i try uncompress a .tar file with utarfile library. When execute this program, all files are descompress, but are empty.
This is based on example-extract.py attached in utarfile library.
Code: Select all
import os
from lib.shutil import shutil
from lib.utarfile import utarfile
t = utarfile.TarFile('file.tar')
for i in t:
print(i)
if i.type == utarfile.DIRTYPE:
os.makedirs(i.name)
else:
f = t.extractfile(i)
shutil.copyfileobj(f, open(i.name, "wb"))