From 58d9a4229e1212a822add27f94974eb8d830038e Mon Sep 17 00:00:00 2001 From: samerbam Date: Thu, 24 Aug 2023 23:29:19 -0400 Subject: [PATCH] limit to only file exists err --- application/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/main.py b/application/main.py index 55a21e4..29848e2 100644 --- a/application/main.py +++ b/application/main.py @@ -72,9 +72,11 @@ def first_run(): with open('.firsttimeruncheck', 'x') as f: f.write("") return {"status": "First Run"} - except Exception as e: + except OSError as e: print(e) - return {"status": "Not First Run"} + if e.errno == errno.EEXIST: + return {"status": "Not First Run"} + @app.get("/api/todos/get")