From 467c436458f165ca6fb0b13ae9b22f919a311db4 Mon Sep 17 00:00:00 2001 From: Floke Date: Tue, 8 Apr 2025 05:48:17 +0000 Subject: [PATCH] debug --- brancheneinstufung.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/brancheneinstufung.py b/brancheneinstufung.py index 33ecc578..7d2516e6 100644 --- a/brancheneinstufung.py +++ b/brancheneinstufung.py @@ -29,6 +29,19 @@ from difflib import SequenceMatcher import unicodedata import csv + +def retry_on_failure(func): + def wrapper(*args, **kwargs): + for attempt in range(Config.MAX_RETRIES): + try: + return func(*args, **kwargs) + except Exception as e: + print(f"⚠️ Fehler bei {func.__name__} (Versuch {attempt+1}): {str(e)[:100]}") + time.sleep(Config.RETRY_DELAY) + return None + return wrapper + + # Optional: tiktoken für Token-Zählung (Modus 8) try: import tiktoken