Skip to content

Commit

Permalink
r.in.srtm: Fix exception handling and add specific error types (OSGeo…
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Oct 23, 2024
1 parent 0582709 commit 3d7b331
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ per-file-ignores =
scripts/db.univar/db.univar.py: E501
scripts/d.frame/d.frame.py: E722
scripts/i.pansharpen/i.pansharpen.py: E722, E501
scripts/r.in.srtm/r.in.srtm.py: E722
scripts/r.fillnulls/r.fillnulls.py: E722
scripts/v.what.strds/v.what.strds.py: E501
# Line too long (esp. module interface definitions)
Expand Down
5 changes: 3 additions & 2 deletions scripts/r.in.srtm/r.in.srtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import atexit
import grass.script as gs
import zipfile as zfile
from grass.exceptions import CalledModuleError


tmpl1sec = """BYTEORDER M
Expand Down Expand Up @@ -227,7 +228,7 @@ def main():
try:
zf = zfile.ZipFile(zipfile)
zf.extractall()
except:
except (zfile.BadZipfile, zfile.LargeZipFile, PermissionError):
gs.fatal(_("Unable to unzip file."))

gs.message(_("Converting input file to BIL..."))
Expand Down Expand Up @@ -274,7 +275,7 @@ def main():

try:
gs.run_command("r.in.gdal", input=bilfile, out=tileout)
except:
except CalledModuleError:
gs.fatal(_("Unable to import data"))

# nice color table
Expand Down

0 comments on commit 3d7b331

Please sign in to comment.