diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 9112072e..c886d1f1 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -482,12 +482,19 @@ class Config: print "\nReading configuration file %s\n" % file try: doc = xml.dom.minidom.parse(file) + self.file_error = None except: log.error("Error parsing %s. See error log file." % (file)) traceback.print_exc(file=sys.stderr) - print "press enter to continue" - sys.stdin.readline() - sys.exit() + self.file_error = sys.exc_info()[1] + # we could add a parameter to decide whether to return or read a line and 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 = (, ExpatError('not well-formed (invalid token): line 511, +# column 4',), ) self.doc = doc self.supported_sites = {} diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 0abffcd0..d48b3149 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -688,6 +688,12 @@ class fpdb: def load_profile(self): """Loads profile from the provided path name.""" 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) print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n" if self.config.example_copy: