Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.in.srtm: Fix exception handling and add specific error types #4571

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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/d.rast.edit/d.rast.edit.py: E722
scripts/v.what.strds/v.what.strds.py: E501
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 @@ -230,7 +231,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 @@ -277,7 +278,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
Loading