Skip to content
Snippets Groups Projects
Commit eedc721a authored by Moritz's avatar Moritz
Browse files

Now catches ImportError if pymultinest is not installed

parent 6c87aa3f
No related branches found
No related tags found
1 merge request!230Resolve "PEP8 Imports"
Pipeline #38251 failed
......@@ -6,15 +6,18 @@ import os
from ..utils import check_directory_exists_and_if_not_mkdir
from .base_sampler import NestedSampler
from ..utils import logger
try:
# Suppresses import error printouts from pymultinest
sys.stdout = open(os.devnull, 'w')
import pymultinest
sys.stdout = sys.__stdout__
try:
# Suppresses import error printouts from pymultinest
sys.stdout = open(os.devnull, 'w')
import pymultinest
sys.stdout = sys.__stdout__
except ImportError:
logger.debug('PyMultinest is not installed on this system, you will '
'not be able to use the PyMultinest sampler')
except SystemExit:
logger.debug('PyMultinest is not installed on this system, you will '
'not be able to use the PyMultinest sampler')
logger.debug('Multinest is not installed on this system, you will '
'not be able to use the Multinest sampler')
class Pymultinest(NestedSampler):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment