Skip to content

Commit

Permalink
Communicate potential error with pytables
Browse files Browse the repository at this point in the history
  • Loading branch information
thouska committed Jun 27, 2019
1 parent 5bdcccf commit 2a0ddf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion spotpy/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def __getattr__(name):
names = __dir__()
print(names)
if name in names:
db_module = import_module('.' + name, __name__)
try:
db_module = import_module('.' + name, __name__)
except ImportError:
db_module = import_module('.base', __name__)
return getattr(db_module, name)
else:
raise AttributeError('{} is not a member of spotpy.database')
Expand Down
7 changes: 6 additions & 1 deletion spotpy/database/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@

import numpy as np
from .base import database
import tables
try:
import tables
except ImportError:
print('ImportError: Pytables is not correctly installed. Please also make sure you',
'installed the hdf5 extension (https://www.hdfgroup.org/downloads/hdf5/)')
raise
import sys
if sys.version_info[0] >= 3:
unicode = str
Expand Down

0 comments on commit 2a0ddf6

Please sign in to comment.