Seite 1 von 1

python shutil move overwrite

Verfasst: Samstag 12. Dezember 2020, 18:48
von stargalaxy
python shutil move overwrite

hab da ein problem was ist da falsch und android geht es
aber unter windows bricht es ab nach extract ab
kodi wizard

def extract(zip_file, output_directory, progress_dialog):
addonPath = xbmc.translatePath('special://home/addons').decode('utf-8')
userPath = xbmc.translatePath('special://home/userdata').decode('utf-8')
addonPathNew = xbmc.translatePath('special://home/addonsAlt').decode('utf-8')
userPathNew = xbmc.translatePath('special://home/userdataAlt').decode('utf-8')
fav = xbmc.translatePath('special://home/userdata/favourites.xml').decode('utf-8')
favNew = xbmc.translatePath('special://home/favourites.xml').decode('utf-8')
shutil.move(fav,favNew)
shutil.move(addonPath,addonPathNew) <----------------------------------------------------------------------------- ab hier
shutil.move(userPath,userPathNew)
shutil.rmtree(addonPathNew, ignore_errors=True)
shutil.rmtree(userPathNew, ignore_errors=True)
zin = zipfile.ZipFile(zip_file)
files_number = len(zin.infolist())
for index, item in enumerate(zin.infolist()):
try:
progress_dialog(index, 1, files_number)
except Canceled:
return False
else:
zin.extract(item, output_directory)
return True