Fehlende Status-Datei akzeptieren

This commit is contained in:
Adrian Heine 2024-10-15 07:32:00 +02:00
parent fcdb73f983
commit 871ace3ba0

View file

@ -241,7 +241,7 @@ class Sesion:
def abfrage(parser, quiero_unidad, otra_vez): def abfrage(parser, quiero_unidad, otra_vez):
random.seed() random.seed()
try: status = {}
palabras = [] palabras = []
os.makedirs(VOKABELN_DIR, exist_ok=True) os.makedirs(VOKABELN_DIR, exist_ok=True)
try: try:
@ -252,9 +252,13 @@ def abfrage(parser, quiero_unidad, otra_vez):
for filename in glob.glob(os.path.join(VOKABELN_DIR, '*.json')): for filename in glob.glob(os.path.join(VOKABELN_DIR, '*.json')):
with open(filename, 'r') as f: with open(filename, 'r') as f:
palabras += json.load(f) palabras += json.load(f)
try:
with open(STATUS_FILE, 'r') as f: with open(STATUS_FILE, 'r') as f:
status = json.load(f) status = json.load(f)
except FileNotFoundError: except FileNotFoundError:
pass
if len(palabras) == 0:
print(f"{bcolors.FAIL}Daten können nicht geladen werden, hast du sie schon importiert?{bcolors.ENDC}") print(f"{bcolors.FAIL}Daten können nicht geladen werden, hast du sie schon importiert?{bcolors.ENDC}")
print() print()
parser.print_help() parser.print_help()