diff --git a/geemap/common.py b/geemap/common.py index 744c09b465..a506b0f90b 100644 --- a/geemap/common.py +++ b/geemap/common.py @@ -5567,7 +5567,7 @@ def stac_tile( try: percentile_2 = min([stats[s]["percentile_2"] for s in stats]) percentile_98 = max([stats[s]["percentile_98"] for s in stats]) - except: + except Exception: percentile_2 = min( [ stats[s][list(stats[s].keys())[0]]["percentile_2"] @@ -11780,7 +11780,7 @@ def classify( cmap = "Blues" try: cmap = plt.get_cmap(cmap, k) - except: + except Exception: cmap = plt.cm.get_cmap(cmap, k) if colors is None: colors = [mpl.colors.rgb2hex(cmap(i))[1:] for i in range(cmap.N)] @@ -12537,7 +12537,7 @@ def get_palette_colors( """ try: cmap = plt.get_cmap(cmap_name, n_class) - except: + except Exception: cmap = plt.cm.get_cmap(cmap_name, n_class) colors = [mpl.colors.rgb2hex(cmap(i))[1:] for i in range(cmap.N)] if hashtag: diff --git a/geemap/conversion.py b/geemap/conversion.py index a0971d8665..8d0b6e8d95 100644 --- a/geemap/conversion.py +++ b/geemap/conversion.py @@ -607,7 +607,7 @@ def js_to_python( try: if (line.replace(" ", ""))[line.find("!") + 1] != "=": line = line.replace("!", "not ") - except: + except Exception: print("continue...") line = line.rstrip() diff --git a/geemap/coreutils.py b/geemap/coreutils.py index 89d3708bb2..7819769087 100644 --- a/geemap/coreutils.py +++ b/geemap/coreutils.py @@ -546,7 +546,7 @@ def widget_template( try: toolbar_button = ipywidgets.ToggleButton(**widget_args) - except: + except Exception: widget_args.pop("layout") toolbar_button = ipywidgets.ToggleButton(**widget_args) toolbar_button.layout.width = "28px" @@ -555,7 +555,7 @@ def widget_template( try: close_button = ipywidgets.ToggleButton(**close_button_args) - except: + except Exception: close_button_args.pop("layout") close_button = ipywidgets.ToggleButton(**close_button_args) close_button.layout.width = "28px" diff --git a/geemap/geemap.py b/geemap/geemap.py index ea19214dc5..99e4957f65 100644 --- a/geemap/geemap.py +++ b/geemap/geemap.py @@ -4372,7 +4372,7 @@ def add_labels( try: size = int(font_size.replace("pt", "")) - except: + except Exception: raise ValueError("font_size must be something like '10pt'") labels = [] diff --git a/geemap/map_widgets.py b/geemap/map_widgets.py index 4381b1a337..e9f0c561eb 100644 --- a/geemap/map_widgets.py +++ b/geemap/map_widgets.py @@ -414,7 +414,7 @@ def _normalize_color_to_hex(self, color: str | tuple) -> str: if isinstance(color, tuple): try: return f"#{coreutils.rgb_to_hex(color)}" - except: + except Exception: raise ValueError(f"Unable to convert rgb value to hex: {color}") elif re.search(r"^(?:[0-9a-fA-F]{3}){1,2}(?:[0-9a-fA-F]{1,2})?$", color): # Add a # for hexadecimal strings of length 3 or 6, with optional diff --git a/geemap/timelapse.py b/geemap/timelapse.py index 8b8bd31304..bc8ac90bf4 100644 --- a/geemap/timelapse.py +++ b/geemap/timelapse.py @@ -27,7 +27,7 @@ try: from PIL import Image, ImageDraw, ImageFont, ImageSequence -except: +except Exception: pass