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

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

parent 9f4c2df4
...@@ -8,6 +8,8 @@ ...@@ -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) - We do not output the break strength from the `bc03` module anymore as these were not computed properly. (Médéric Boquien)
### Fixed ### 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 ### Optimised
## 0.10.0 (2016-09-15) ## 0.10.0 (2016-09-15)
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
import pkgutil import pkgutil
from collections import Iterable, OrderedDict from collections import Iterable, OrderedDict
import multiprocessing as mp import multiprocessing as mp
import os.path
import sys
from textwrap import wrap from textwrap import wrap
import configobj import configobj
...@@ -57,6 +59,8 @@ class Configuration(object): ...@@ -57,6 +59,8 @@ class Configuration(object):
# we actually return the configuration file from the property() method. # we actually return the configuration file from the property() method.
self.config.validate(validate.Validator(validation.functions)) self.config.validate(validate.Validator(validation.functions))
self.pcigaleini_exists = os.path.isfile(filename)
def create_blank_conf(self): def create_blank_conf(self):
"""Create the initial configuration file """Create the initial configuration file
...@@ -127,6 +131,9 @@ class Configuration(object): ...@@ -127,6 +131,9 @@ class Configuration(object):
selection based on the filters identified in the data table file. 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 # Getting the list of the filters available in pcigale database
with Database() as base: with Database() as base:
...@@ -220,6 +227,10 @@ class Configuration(object): ...@@ -220,6 +227,10 @@ class Configuration(object):
configuration: dictionary configuration: dictionary
Dictionary containing the information provided in pcigale.ini. 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_redshifts()
self.complete_analysed_parameters() self.complete_analysed_parameters()
......
Supports Markdown
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