Skip to content

Commit

Permalink
Merge pull request #501 from ipelupessy/no_config_error
Browse files Browse the repository at this point in the history
allow amuse to run w/o config (until it is needed)
  • Loading branch information
ipelupessy committed Oct 4, 2019
2 parents 377be64 + aa0f917 commit b2a66f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/amuse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ def numpy_fix():

numpy_fix()

class NoConfig(object):
def __init__(self, message):
self._message=message
def __getattr__(self, attr):
raise Exception(self._message)

try:
from . import config
except:
raise ImportError("amuse is not configured correctly")
except Exception as ex:
message="Configuration not read in - or configuration invalid, exception:\n"+str(ex)
config=NoConfig(message)

0 comments on commit b2a66f9

Please sign in to comment.