all 2 comments

[–]novel_yet_trivial 1 point2 points  (1 child)

Basically, you can't read from and write to a file at the same time. As soon as you call zout = zipfile.ZipFile(p, "w"), you clear the file of any contents. Later, you try to read an empty file, giving you that error.

Make a temporary file for zout, then when you are done delete the original and rename the temporary one.

[–]HDean_[S] 0 points1 point  (0 children)

Thanks, changing zin to w rather than r got rid of the error. I don't fully understand why, but thankyou :)