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

wxGUI: Improve exception handling specificity in location wizard #4953

Merged
merged 2 commits into from
Jan 18, 2025
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 @@ -29,7 +29,6 @@ per-file-ignores =
gui/wxpython/animation/g.gui.animation.py: E501
gui/wxpython/tplot/g.gui.tplot.py: E501
gui/wxpython/iclass/g.gui.iclass.py: E501
gui/wxpython/location_wizard/wizard.py: E722
gui/wxpython/mapdisp/main.py: E722
gui/wxpython/mapdisp/test_mapdisp.py: E501
gui/wxpython/mapswipe/g.gui.mapswipe.py: E501
Expand Down
18 changes: 9 additions & 9 deletions gui/wxpython/location_wizard/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def OnSearch(self, event):
self.proj, self.projdesc = self.projlist.Search(
index=[0, 1], pattern=search_str
)
except:
except (IndexError, ValueError):
self.proj = self.projdesc = ""

event.Skip()
Expand Down Expand Up @@ -1188,15 +1188,15 @@ def OnDText(self, event):
self.datumparams = self.parent.datums[self.datum][2]
try:
self.datumparams.remove("dx=0.0")
except:
except ValueError:
pass
try:
self.datumparams.remove("dy=0.0")
except:
except ValueError:
pass
try:
self.datumparams.remove("dz=0.0")
except:
except ValueError:
pass

nextButton.Enable(True)
Expand All @@ -1211,7 +1211,7 @@ def OnDSearch(self, event):
self.datum, self.ellipsoid, self.datumdesc = self.datumlist.Search(
index=[0, 1, 2], pattern=search_str
)
except:
except (IndexError, ValueError):
self.datum = self.datumdesc = self.ellipsoid = ""

event.Skip()
Expand Down Expand Up @@ -1392,7 +1392,7 @@ def OnSearch(self, event):
self.ellipseparams = self.parent.ellipsoids[self.ellipse][1]
else:
self.ellipseparams = self.parent.planetary_ellipsoids[self.ellipse][1]
except:
except (IndexError, ValueError, KeyError):
self.ellipse = self.ellipsedesc = self.ellipseparams = ""

event.Skip()
Expand Down Expand Up @@ -1935,7 +1935,7 @@ def OnText(self, event):
self.epsgcode = event.GetString()
try:
self.epsgcode = int(self.epsgcode)
except:
except ValueError:
self.epsgcode = None

nextButton = wx.FindWindowById(wx.ID_FORWARD)
Expand Down Expand Up @@ -2558,7 +2558,7 @@ def __readData(self):
plist.append(p)
self.projections[proj.lower().strip()] = (projdesc.strip(), plist)
self.projdesc[proj.lower().strip()] = projdesc.strip()
except:
except (ValueError, IndexError):
continue
f.close()

Expand Down Expand Up @@ -2620,7 +2620,7 @@ def __readData(self):
try:
pparam, datatype, proj4term, desc = line.split(":")
self.paramdesc[pparam] = (datatype, proj4term, desc)
except:
except ValueError:
continue
f.close()

Expand Down
Loading