From ef05eae0bc10e54cfa796d76f47cc0776fb0c02b Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Fri, 20 Nov 2020 16:17:40 +0100 Subject: [PATCH] manage_sql.py: check that the config file exists --- manage_sql.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manage_sql.py b/manage_sql.py index a1f7452..8877e30 100755 --- a/manage_sql.py +++ b/manage_sql.py @@ -12,10 +12,17 @@ # */ from configparser import ConfigParser +import os import pymysql +import sys # Read conf.ini INI_CONF = "./config/sql_conf.ini" + +if os.path.exists(INI_CONF) is False: + print("MySQL configuration error, {}: file not found".format(INI_CONF)) + sys.exit(1) + CONFIG = ConfigParser() CONFIG.read(INI_CONF)