Jun-13-2021, 12:37 PM
Hello,
I'm trying to zip 1 big txt file before upload it (so insted of 22MB it will be ~ 2MB )
but the file created is 22MB and it's corrupted
the Output fie is working and readable - no problem there
I have also try to do this
how could it be ?
and also it zipp me the all path of the file - meaning I have 4 folders before I get into the txt file in the zip
why? how can I make it only the file itself?
Thanks ,
I'm trying to zip 1 big txt file before upload it (so insted of 22MB it will be ~ 2MB )
but the file created is 22MB and it's corrupted
the Output fie is working and readable - no problem there
OutputFile = 'D:\\Sync\\Sync\\Upload\\CutLogData1.txt' zipObj = ZipFile('D:\\Sync\\Sync\\Upload\\ZIPData.zip', 'w') with open(OutputFile, 'w') as f: for line in Lines: count += 1 if StartLine <= count <= EndLine: f.write(line.strip() + "\r\n") # OutputFile.write(line.strip() + "\r\n") zipObj.write(OutputFile) zipObj.close() f.close()what did I do wrong ?
I have also try to do this
ZipLocation = ('D:\\Sync\\Sync\\Upload\\CanBusData.zip') with ZipFile(ZipLocation, 'w') as zipObj: zipObj.write(OutputFile)but the file is the same as the txt ~ 22MB
how could it be ?
and also it zipp me the all path of the file - meaning I have 4 folders before I get into the txt file in the zip
why? how can I make it only the file itself?
Thanks ,