display popup if error parsing config file
This commit is contained in:
parent
0cafb75c59
commit
ebf2205859
|
@ -481,12 +481,19 @@ class Config:
|
||||||
print "\nReading configuration file %s\n" % file
|
print "\nReading configuration file %s\n" % file
|
||||||
try:
|
try:
|
||||||
doc = xml.dom.minidom.parse(file)
|
doc = xml.dom.minidom.parse(file)
|
||||||
|
self.file_error = None
|
||||||
except:
|
except:
|
||||||
log.error("Error parsing %s. See error log file." % (file))
|
log.error("Error parsing %s. See error log file." % (file))
|
||||||
traceback.print_exc(file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
print "press enter to continue"
|
self.file_error = sys.exc_info()[1]
|
||||||
sys.stdin.readline()
|
# we could add a parameter to decide whether to return or read a line and exit?
|
||||||
sys.exit()
|
return
|
||||||
|
#print "press enter to continue"
|
||||||
|
#sys.stdin.readline()
|
||||||
|
#sys.exit()
|
||||||
|
#ExpatError: not well-formed (invalid token): line 511, column 4
|
||||||
|
#sys.exc_info = (<class 'xml.parsers.expat.ExpatError'>, ExpatError('not well-formed (invalid token): line 511,
|
||||||
|
# column 4',), <traceback object at 0x024503A0>)
|
||||||
|
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.supported_sites = {}
|
self.supported_sites = {}
|
||||||
|
|
|
@ -688,6 +688,12 @@ class fpdb:
|
||||||
def load_profile(self):
|
def load_profile(self):
|
||||||
"""Loads profile from the provided path name."""
|
"""Loads profile from the provided path name."""
|
||||||
self.config = Configuration.Config(file=options.config, dbname=options.dbname)
|
self.config = Configuration.Config(file=options.config, dbname=options.dbname)
|
||||||
|
if self.config.file_error:
|
||||||
|
self.warning_box( "There is an error in your config file\n" + self.config.file
|
||||||
|
+ "\n\nError is: " + str(self.config.file_error)
|
||||||
|
, diatitle="CONFIG FILE ERROR" )
|
||||||
|
exit()
|
||||||
|
|
||||||
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
|
log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log)
|
||||||
print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
|
print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n"
|
||||||
if self.config.example_copy:
|
if self.config.example_copy:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user