let the download script remove the extraction folder in case it exists

This commit is contained in:
oy 2019-01-19 13:42:45 +01:00
parent 689be6529d
commit 6ec984bbd5

View file

@ -8,6 +8,12 @@ def unzip(filename, where):
z = zipfile.ZipFile(filename, "r") z = zipfile.ZipFile(filename, "r")
except: except:
return False return False
# remove extraction folder, if it exists
if os.path.exists(z.namelist()[0]):
shutil.rmtree(z.namelist()[0])
# extract files
for name in z.namelist(): for name in z.namelist():
z.extract(name, where) z.extract(name, where)
z.close() z.close()