Commit 642c4574 authored by Devaev Maxim's avatar Devaev Maxim

Log exceptions at file creating in PlainConfig

parent 2ed738ed
...@@ -50,13 +50,17 @@ class PlainEditor(object) : ...@@ -50,13 +50,17 @@ class PlainEditor(object) :
if not os.access(config_file_path, os.F_OK) : if not os.access(config_file_path, os.F_OK) :
logger.debug("{submod}: Config file \"%s\" does not exist" % (config_file_path)) logger.debug("{submod}: Config file \"%s\" does not exist" % (config_file_path))
if sample_config_file_path != None and os.access(sample_config_file_path, os.F_OK) : try :
shutil.copy2(sample_config_file_path, config_file_path) if sample_config_file_path != None and os.access(sample_config_file_path, os.F_OK) :
logger.debug("{submod}: Config file \"%s\" has been created from sample \"%s\"" % ( shutil.copy2(sample_config_file_path, config_file_path)
config_file_path, sample_config_file_path )) logger.debug("{submod}: Config file \"%s\" has been created from sample \"%s\"" % (
else : config_file_path, sample_config_file_path ))
open(config_file_path, "w").close() else :
logger.debug("{submod}: Created empty file \"%s\"" % (config_file_path)) open(config_file_path, "w").close()
logger.debug("{submod}: Created empty file \"%s\"" % (config_file_path))
except :
logger.error("Cannot create config file \"%s\"" % (config_file_path))
logger.attachException()
config_file = open(config_file_path, "r") config_file = open(config_file_path, "r")
self.__config_file_data_list = config_file.read().split("\n") self.__config_file_data_list = config_file.read().split("\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment