Fehler beim Löschen werden abgefangen

This commit is contained in:
hubobel 2025-12-29 16:35:26 +01:00
parent a8a3bdc028
commit 96ef315eee

View file

@ -462,8 +462,11 @@ def zufName(geschlecht):
return random.choice(data["Mann"]) return random.choice(data["Mann"])
def delete(pfad_ogg): def delete(pfad_ogg):
if pfad_ogg.exists(): if pfad_ogg.exists():
pfad_ogg.unlink() try:
logging.info("Datei gelöscht: %s", pfad_ogg) pfad_ogg.unlink()
logging.info("Datei gelöscht: %s", pfad_ogg)
except:
logging.info("Datei gerade in Benutzung: %s", pfad_ogg)
return None return None
host = os.getcwd() host = os.getcwd()