Skip to content

Commit

Permalink
Added app exit on error
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgr98 committed Jan 13, 2023
1 parent 2d9bdd3 commit 60bae2d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PySimpleGUI as sg
import tomllib as tml
import json
import sys

icon = './heart.ico'

Expand All @@ -9,6 +10,7 @@
config = tml.load(f)
except FileNotFoundError:
sg.popup('File "config.toml" not found...', title='Opps!', button_type=sg.POPUP_BUTTONS_OK)
sys.exit()

lang = config['app']['lang']

Expand All @@ -17,6 +19,7 @@
msg = json.load(f)
except FileNotFoundError:
sg.popup('File "msg.json" not found...', title='Opps!', button_type=sg.POPUP_BUTTONS_OK)
sys.exit()

# check if the language is supported in msg.json
if lang not in msg:
Expand Down

0 comments on commit 60bae2d

Please sign in to comment.