I’m currently writing an updater for my python program. It downloads a zip file and then opens it with the zipfile module. I loop through all the files in the zip, and if the file is not called ‘updater.exe’, extract it to the current directory. However, the program stops after extracting one file. I’ve seen people having a similar problem, but the answer appears tobe use extractall, which I cannot do because I can’t extract updater.exe since the file will be overwritten and that is the program that will be running to do this task. I do want everything else to be overwritten. I am also using wxpython for progress dialogs. Here’s the code I use for opening the zip file and extracting it.
with ZipFile('wotu.zip', 'r') as f:
files=f.namelist()
dlg=wx.ProgressDialog('Updating', 'Extracting files...', len(files))
progress=0
for file in files:
if file != 'updater.exe':
print(file)
f.extract(file)
progress+=1
dlg.Update(progress)