Skip to content

Commit

Permalink
i.pansharpen: Fixed bare except clause (#4596)
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Oct 28, 2024
1 parent 6bceb98 commit b9a543a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ per-file-ignores =
scripts/v.import/v.import.py: E722, E501
scripts/db.univar/db.univar.py: E501
scripts/d.frame/d.frame.py: E722
scripts/i.pansharpen/i.pansharpen.py: E722, E501
scripts/i.pansharpen/i.pansharpen.py: E501
scripts/v.what.strds/v.what.strds.py: E501
# Line too long (esp. module interface definitions)
scripts/*/*.py: E501
Expand Down
11 changes: 6 additions & 5 deletions scripts/i.pansharpen/i.pansharpen.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
# %end

import os
from grass.exceptions import CalledModuleError

try:
import numpy as np
Expand Down Expand Up @@ -458,7 +459,7 @@ def main():
gs.run_command(
"g.remove", flags="f", type="raster", pattern="tmp%s*" % pid, quiet=True
)
except:
except CalledModuleError:
pass


Expand Down Expand Up @@ -523,7 +524,7 @@ def brovey(pan, ms1, ms2, ms3, out, pid, sproc):
pb.wait(), pg.wait(), pr.wait()
try:
pb.terminate(), pg.terminate(), pr.terminate()
except:
except OSError:
pass

# Cleanup
Expand All @@ -535,7 +536,7 @@ def brovey(pan, ms1, ms2, ms3, out, pid, sproc):
type="raster",
name="%s,%s,%s" % (panmatch1, panmatch2, panmatch3),
)
except:
except CalledModuleError:
pass


Expand Down Expand Up @@ -575,7 +576,7 @@ def ihs(pan, ms1, ms2, ms3, out, pid, sproc):
# Cleanup
try:
gs.run_command("g.remove", flags="f", quiet=True, type="raster", name=panmatch)
except:
except CalledModuleError:
pass


Expand Down Expand Up @@ -701,7 +702,7 @@ def pca(pan, ms1, ms2, ms3, out, pid, sproc):
pb.wait(), pg.wait(), pr.wait()
try:
pb.terminate(), pg.terminate(), pr.terminate()
except:
except OSError:
pass

# Cleanup
Expand Down

0 comments on commit b9a543a

Please sign in to comment.