Skip to content

Commit

Permalink
r.green/r.green.hydro: fix import py modules from libhydro, libgreen …
Browse files Browse the repository at this point in the history
…lib (#225)
  • Loading branch information
tmszi committed Jul 25, 2020
1 parent 1a09798 commit 6ca318a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,24 @@
from grass.pygrass.raster import RasterRow
from grass.script.core import overwrite, parser, warning
from grass.script.utils import set_path
from libgreen.checkparameter import check_required_columns, exception2error
from libhydro.optimal import conv_segpoints
from libhydro.plant import read_plants, write_structures

try:
# set python path to the shared r.green libraries
set_path('r.green', 'libhydro', '..')
set_path('r.green', 'libgreen', os.path.join('..', '..'))
from libhydro.optimal import conv_segpoints
from libhydro.plant import read_plants, write_structures
from libgreen.checkparameter import check_required_columns, \
exception2error
from libgreen.utils import cleanup
except ImportError:
try:
set_path('r.green', 'libhydro', os.path.join('..', 'etc', 'r.green'))
set_path('r.green', 'libgreen', os.path.join('..', 'etc', 'r.green'))
from libhydro.optimal import conv_segpoints
from libhydro.plant import read_plants, write_structures
from libgreen.checkparameter import check_required_columns, \
exception2error
from libgreen.utils import cleanup
except ImportError:
warning('libgreen and libhydro not in the python path!')
Expand Down

0 comments on commit 6ca318a

Please sign in to comment.