diff --git a/src/config.py b/src/config.py index 429e8f2..de501b4 100644 --- a/src/config.py +++ b/src/config.py @@ -12,6 +12,12 @@ def get_display_size(display_height): A tuple with the display dimension. The aspect ratio is always 4:3. """ + try: + display_height = int(display_height) + except ValueError: + display_height = 900 + print("invalid display height value in .env, using defaults") + return ( display_height / 0.75, display_height @@ -23,11 +29,11 @@ def get_display_size(display_height): try: load_dotenv(dotenv_path=os.path.join(dirname, "..", ".env")) except FileNotFoundError: - print("no .env file found, using defaults") + pass DISPLAY_SIZE = get_display_size( - display_height=int(os.getenv("DISPLAY_HEIGHT")) or 900 + display_height=os.getenv("DISPLAY_HEIGHT") or 900 ) DATABASE_FILENAME = os.getenv("DATABASE_FILENAME") or "database.db"