Browse Source

Fehlende Status-Datei akzeptieren

main
Adrian Heine 2 months ago
parent
commit
871ace3ba0
  1. 22
      main.py

22
main.py

@ -241,20 +241,24 @@ class Sesion:
def abfrage(parser, quiero_unidad, otra_vez):
random.seed()
status = {}
palabras = []
os.makedirs(VOKABELN_DIR, exist_ok=True)
try:
palabras = []
os.makedirs(VOKABELN_DIR, exist_ok=True)
try:
os.rename(DEPRECATED_VOKABELN_FILE, os.path.join(VOKABELN_DIR, 'vokabeln.json'))
except FileNotFoundError:
pass
os.rename(DEPRECATED_VOKABELN_FILE, os.path.join(VOKABELN_DIR, 'vokabeln.json'))
except FileNotFoundError:
pass
for filename in glob.glob(os.path.join(VOKABELN_DIR, '*.json')):
with open(filename, 'r') as f:
palabras += json.load(f)
for filename in glob.glob(os.path.join(VOKABELN_DIR, '*.json')):
with open(filename, 'r') as f:
palabras += json.load(f)
try:
with open(STATUS_FILE, 'r') as f:
status = json.load(f)
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()
parser.print_help()

Loading…
Cancel
Save