Skip to content

Commit

Permalink
r.out.kde: fix lazy import of 'PIL' module (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed Jan 2, 2021
1 parent e1a1d99 commit 69d743e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions grass7/raster/r.out.kde/r.out.kde.py
Expand Up @@ -62,6 +62,12 @@ def cleanup():


def main(rinput, background, output, method):
try:
from PIL import Image
except ImportError:
gscript.fatal("Cannot import PIL."
" Please install the Python pillow package.")

if '@' in rinput:
rinput = rinput.split('@')[0]
suffix = '_' + os.path.basename(gscript.tempfile(False))
Expand Down Expand Up @@ -125,11 +131,6 @@ def scale(cmin, cmax, intens, method):


if __name__ == "__main__":
try:
from PIL import Image
except ImportError:
gscript.fatal("Cannot import PIL."
" Please install the Python pillow package.")
options, flags = gscript.parser()
rinput = options['input']
bg = options['background']
Expand Down

0 comments on commit 69d743e

Please sign in to comment.