From c651950e7c0e05334d244e3f963ba40ee4392137 Mon Sep 17 00:00:00 2001 From: piair Date: Sun, 6 Nov 2022 17:44:35 +0100 Subject: [PATCH] wasn't working --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8e7d733..01ef1a7 100644 --- a/main.py +++ b/main.py @@ -8,8 +8,9 @@ config = configparser.ConfigParser() try : config_path = f"{os.path.abspath( os.path.dirname( __file__ ) )}/user_data/config.cfg" - config.read(config_path) -except : + if config.read(config_path)==[] : + raise NameError("le fichier n'existe pas") +except : #doesn't work default_config = f"{os.path.abspath( os.path.dirname( __file__ ) )}/user_data/config.default" shutil.copyfile(default_config, config_path) config.read(config_path)