I am running the following code to caluclate CRC32 of ZIP file
buf = open("C:\\users\\Raj\\temp\\ZIPs\\XXX.ZIP",'rb').read()
MemoryError
If i restart the machines it works fine and after running this command for multiple times i am getting the same error
This is the code i am using for caluclating CRC of ZIP file more than a 1.5 GB
zip_file=C:\\users\\Raj\\temp\\ZIPs\\XXX.ZIP"
buf = open(zip_file,'rb').read()
buf = (binascii.crc32(buf) & 0xFFFFFFFF)
(open(zip_file,'rb')).close()
You are not closing the opened zip file. Try this:
zip_file="C:\\users\\Raj\\temp\\ZIPs\\XXX.ZIP"
with open(zip_file,'rb') as handle:
buf = handle.read()
buf = (binascii.crc32(buf) & 0xFFFFFFFF)
User contributions licensed under CC BY-SA 3.0