I should just unzip RESULT folder inside of output.tgz archive
#!/usr/bin/python
import os, sys, tarfile, gzip
def unZip(self,file, filename,dire):
tar = tarfile.open(filename,"r:gz")
for file in tar.getmembers():
if file.name.startswith("RESULT"):
tar.extract(file,dire)
print 'Done.'
def main():
utilities = ZipUtil()
filename = 'output.tgz'
directory = str(sys.argv[1]);
path = os.path.join(directory, filename)
utilities.unZip(directory,path,directory)
main()
and I'm getting this error
File "/usr/lib64/python2.7/tarfile.py", line 1805, in getmembers
self._load() # all members, we first have to
File "/usr/lib64/python2.7/tarfile.py", line 2380, in _load
tarinfo = self.next()
File "/usr/lib64/python2.7/tarfile.py", line 2315, in next
self.fileobj.seek(self.offset)
File "/usr/lib64/python2.7/gzip.py", line 429, in seek
self.read(1024)
File "/usr/lib64/python2.7/gzip.py", line 256, in read
self._read(readsize)
File "/usr/lib64/python2.7/gzip.py", line 303, in _read
self._read_eof()
File "/usr/lib64/python2.7/gzip.py", line 342, in _read_eof
hex(self.crc)))
IOError: CRC check failed 0xccf8af55 != 0x43cb4d43L
There are many questions like this but still now answer for this proble. The file output.tgz is downloaded and it might be corrupted this is why I guess its not working. But is there anyway around to tell tar to open it. THnak a lot!