Fehlende Status-Datei akzeptieren
This commit is contained in:
parent
fcdb73f983
commit
871ace3ba0
1 changed files with 13 additions and 9 deletions
22
main.py
22
main.py
|
|
@ -241,20 +241,24 @@ class Sesion:
|
||||||
|
|
||||||
def abfrage(parser, quiero_unidad, otra_vez):
|
def abfrage(parser, quiero_unidad, otra_vez):
|
||||||
random.seed()
|
random.seed()
|
||||||
|
status = {}
|
||||||
|
palabras = []
|
||||||
|
os.makedirs(VOKABELN_DIR, exist_ok=True)
|
||||||
try:
|
try:
|
||||||
palabras = []
|
os.rename(DEPRECATED_VOKABELN_FILE, os.path.join(VOKABELN_DIR, 'vokabeln.json'))
|
||||||
os.makedirs(VOKABELN_DIR, exist_ok=True)
|
except FileNotFoundError:
|
||||||
try:
|
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')):
|
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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue