Merge pull request 'manage_sql.py: check that the config file exists' (#1) from alarig/python-module-mysql:master into master
Reviewed-on: #1
This commit is contained in:
commit
47fd8f3f30
|
@ -12,10 +12,17 @@
|
||||||
# */
|
# */
|
||||||
|
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
import os
|
||||||
import pymysql
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
# Read conf.ini
|
# Read conf.ini
|
||||||
INI_CONF = "./config/sql_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 = ConfigParser()
|
||||||
CONFIG.read(INI_CONF)
|
CONFIG.read(INI_CONF)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue