Commit 16040c52 authored by Médéric Boquien's avatar Médéric Boquien

Rather than crashing, simply display a message when pcigale.ini is missing.

parent 9f4c2df4
......@@ -8,6 +8,8 @@
- We do not output the break strength from the `bc03` module anymore as these were not computed properly. (Médéric Boquien)
### Fixed
- When the pcigale.ini file was missing, pcigale would crash and display a fairly cryptic backtrace. Now it explicitly states that the file could not be found. (Médéric Boquien)
### Optimised
## 0.10.0 (2016-09-15)
......
......@@ -6,6 +6,8 @@
import pkgutil
from collections import Iterable, OrderedDict
import multiprocessing as mp
import os.path
import sys
from textwrap import wrap
import configobj
......@@ -57,6 +59,8 @@ class Configuration(object):
# we actually return the configuration file from the property() method.
self.config.validate(validate.Validator(validation.functions))
self.pcigaleini_exists = os.path.isfile(filename)
def create_blank_conf(self):
"""Create the initial configuration file
......@@ -127,6 +131,9 @@ class Configuration(object):
selection based on the filters identified in the data table file.
"""
if self.pcigaleini_exists is False:
print("Error: pcigale.ini could not be found.")
sys.exit(1)
# Getting the list of the filters available in pcigale database
with Database() as base:
......@@ -220,6 +227,10 @@ class Configuration(object):
configuration: dictionary
Dictionary containing the information provided in pcigale.ini.
"""
if self.pcigaleini_exists is False:
print("Error: pcigale.ini could not be found.")
sys.exit(1)
self.complete_redshifts()
self.complete_analysed_parameters()
......
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