#!/usr/bin/env python
import gzip
import os
sourceFile = raw_input("Please enter the input compressed file name:")
if (os.path.exists(sourceFile)):
pass
else:
print "Sorry, cant find the file! Please check if the filename and path are correct!\n"
exit(0)
destFile = raw_input("Please enter the output de-compressed file name:")
zipFile = gzip.open(sourceFile,"rb")
unCompressedFile = open(destFile,"wb")
decoded = zipFile.read()
unCompressedFile.write(decoded)
zipFile.close()
unCompressedFile.close()
import gzip
import os
sourceFile = raw_input("Please enter the input compressed file name:")
if (os.path.exists(sourceFile)):
pass
else:
print "Sorry, cant find the file! Please check if the filename and path are correct!\n"
exit(0)
destFile = raw_input("Please enter the output de-compressed file name:")
zipFile = gzip.open(sourceFile,"rb")
unCompressedFile = open(destFile,"wb")
decoded = zipFile.read()
unCompressedFile.write(decoded)
zipFile.close()
unCompressedFile.close()
IOError: [Errno 21] Is a directory:
ReplyDeleteI want to extract into a directory as my gzip contains many files and i'm getting the above error. What could be the soution