diff --git a/examples/scripts/98_download_tiles.py b/examples/scripts/98_download_tiles.py index da8c477ca18614d265603afbd7057983a07e9d76..c22b7033e02e47951f8e1012111c44a8eff7d1f2 100644 --- a/examples/scripts/98_download_tiles.py +++ b/examples/scripts/98_download_tiles.py @@ -36,12 +36,12 @@ for index, row in tiles_list.iterrows(): try: if math.isnan(row.start_time): row.start_time = (datetime.datetime.now()-datetime.timedelta(days=delta_t)).strftime('%Y-%m-%d') - except: + except Exception: pass try: if math.isnan(row.end_time): row.end_time = (datetime.datetime.now()+datetime.timedelta(days=1)).strftime('%Y-%m-%d') - except: + except Exception: pass # Pour ponctuellement forcer les dates de début et fin diff --git a/examples/scripts/99_traitement_l2a_multiprocessing.py b/examples/scripts/99_traitement_l2a_multiprocessing.py index b5061730673c96c90cf075a5dc2689366dee3cf4..988e2c331838a9a61a7886829d5e27dcee9ed538 100644 --- a/examples/scripts/99_traitement_l2a_multiprocessing.py +++ b/examples/scripts/99_traitement_l2a_multiprocessing.py @@ -15,7 +15,7 @@ from itertools import chain try: arg = sys.argv[1] -except: +except Exception: arg = [] print(arg) diff --git a/examples/scripts/download_tiles.py b/examples/scripts/download_tiles.py index 3a33c8cd126c0b85f7dd620de40822eafeea34e9..7932648734fbab7f5f821df23445f3f00b4bf653 100644 --- a/examples/scripts/download_tiles.py +++ b/examples/scripts/download_tiles.py @@ -35,12 +35,12 @@ for index, row in tiles_list.iterrows(): try: if math.isnan(row.start_time): row.start_time = (datetime.datetime.now()-datetime.timedelta(days=delta_t)).strftime('%Y-%m-%d') - except: + except Exception: pass try: if math.isnan(row.end_time): row.end_time = (datetime.datetime.now()+datetime.timedelta(days=1)).strftime('%Y-%m-%d') - except: + except Exception: pass tuile = Tile(row.tile) diff --git a/examples/scripts/process_l2a_and_indices_by_identifier_multiprocessing.py b/examples/scripts/process_l2a_and_indices_by_identifier_multiprocessing.py index 176857e5367164231efa2c790d631644566d3c11..5b02ba1ce8913fe5dad3e6f0c2d146d85a046390 100644 --- a/examples/scripts/process_l2a_and_indices_by_identifier_multiprocessing.py +++ b/examples/scripts/process_l2a_and_indices_by_identifier_multiprocessing.py @@ -26,7 +26,7 @@ from itertools import chain try: arg = sys.argv[1] -except: +except Exception: arg = [] print(arg) diff --git a/examples/scripts/process_l2a_and_indices_multiprocessing.py b/examples/scripts/process_l2a_and_indices_multiprocessing.py index 020e1939f15f7c3b6e98f9cdeeaaf6a36e08d29e..d8d0550e7b74418764d366ea7e93cc4a271cbc18 100644 --- a/examples/scripts/process_l2a_and_indices_multiprocessing.py +++ b/examples/scripts/process_l2a_and_indices_multiprocessing.py @@ -24,7 +24,7 @@ from itertools import chain try: arg = sys.argv[1] -except: +except Exception: arg = [] print(arg) diff --git a/examples/scripts/process_l2a_and_products.py b/examples/scripts/process_l2a_and_products.py index 6f1a755279e2f018e13e583b3680e697a9e3850d..e19b896c058edbda9c5e0551e0612dba06b00c54 100644 --- a/examples/scripts/process_l2a_and_products.py +++ b/examples/scripts/process_l2a_and_products.py @@ -16,7 +16,7 @@ def process_missings(tile): l1c = L1cProduct(p.identifier, t.name) try: l1c.process_l2a() - except: + except Exception: print("FAILED:", p.identifier) continue @@ -27,7 +27,7 @@ def process_missings(tile): #~ list of indices to be caculated (available : NDVI/NDWIGAO/NDWIMCF/BIGR/BIRNIR/BIBG), #~ And calculation of clouds_nodata (True/False) and quicklook (True/False) l2a.process_indices(["NDVI","NDWIGAO","NDWIMCF","MNDWI"], True, True) - except: + except Exception: print("FAILED:", p.identifier) continue diff --git a/sen2chain/download_eodag.py b/sen2chain/download_eodag.py index e636cdd9d4faa73c4b29078d2234ca2cf7203dd6..2203117758785fbb14a576fa86f18c9a152fbda3 100644 --- a/sen2chain/download_eodag.py +++ b/sen2chain/download_eodag.py @@ -94,7 +94,7 @@ class S2cEodag: logger.info("Issue with this tile search for now, should try to increase the timeout for this provider or check your internet connexion") self.products = [] pass - except: + except Exception: logging.disable(logging.NOTSET) logger.info("An error occured check everything") self.products = [] @@ -143,7 +143,7 @@ class S2cEodag: else: try: prop = p.properties["storageStatus"] - except: + except Exception: if p.properties["storage"]["mode"] == "tier2": p.properties["storageStatus"] = "ONLINE" if not(min_cloudcover <= float(p.properties["cloudCover"] or 0) <= max_cloudcover): @@ -356,7 +356,7 @@ class S2cEodag: logger.info("Found existing zipfile {}".format(zip_file.name)) try: L1cProduct(product_id.properties["id"]).remove(zipfile = True) - except: + except Exception: logger.info("Issue with removing {}".format(zip_file)) pass elif "L2A" in product_id.properties['title']: @@ -365,7 +365,7 @@ class S2cEodag: logger.info("Found existing zipfile {}".format(zip_file.name)) try: L2aProduct(product_id.properties["id"]).remove(zipfile = True) - except: + except Exception: logger.info("Issue with removing {}".format(zip_file)) pass @@ -380,7 +380,7 @@ class S2cEodag: wait=1, timeout=0, ) - # except: + # except Exception: # logger.info("Issue with dowloading {}, removing corrupted zipfile".format(product_id.properties["id"])) # downloaded_path = None # pass @@ -420,7 +420,7 @@ class S2cEodag: wait=1, timeout=0, ) - except: + except Exception: logger.info("remote OFFLINE, ordered") elif product_id.properties["storageStatus"] == "STAGING": @@ -438,7 +438,7 @@ class S2cEodag: wait=1, timeout=0, ) - except: + except Exception: logger.info("{} - remote OFFLINE, ordered".format(product_id.properties["title"])) setup_logging(verbose = 2) @@ -499,11 +499,11 @@ def S2cEodag_download_uniq( ignore_errors = True, ) logger.info("Moving up files and deleting old folder") - except: + except Exception: logger.info("Error: Issue while moving up extracted file") pass set_permissions(Path(downloaded_path)) - except: + except Exception: logger.info("Error: Something went wrong with download process, retry later") elif product.properties["storageStatus"] == "OFFLINE": @@ -518,7 +518,7 @@ def S2cEodag_download_uniq( timeout=0, ) setup_logging(verbose = 2) - except: + except Exception: logger.info("OFFLINE product, ordered, retry later") elif product.properties["storageStatus"] == "STAGING": @@ -551,7 +551,7 @@ def S2cEodag_download( while True: try: S2cEodag_download_uniq(q.get()) - except: + except Exception: import traceback logger.error(traceback.format_exc()) #TODO should cleanup the tile diff --git a/sen2chain/indices.py b/sen2chain/indices.py index ce866a22a7ef82169e53b863d40e9c8688fa0b40..9872d76d303d233b3d7b4ba827b37c934e3952dc 100644 --- a/sen2chain/indices.py +++ b/sen2chain/indices.py @@ -174,7 +174,7 @@ class Ndvi(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / (self.indice_stem + self.ext_raw_aux))) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: @@ -307,7 +307,7 @@ class NdwiMcf(Indice): os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: @@ -440,7 +440,7 @@ class NdwiGao(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: @@ -569,7 +569,7 @@ class Mndwi(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: @@ -700,7 +700,7 @@ class Ndre(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: cmap = matplotlib_colormap_to_rgb(self.colormap, revers=False) @@ -833,7 +833,7 @@ class IRECI(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: cmap = matplotlib_colormap_to_rgb(self.colormap, revers=False) @@ -962,7 +962,7 @@ class BIGR(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: @@ -1094,7 +1094,7 @@ class BIRNIR(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: @@ -1224,7 +1224,7 @@ class BIBG(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: cmap = matplotlib_colormap_to_rgb(self.colormap, revers=False) @@ -1353,7 +1353,7 @@ class EVI(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: cmap = matplotlib_colormap_to_rgb(self.colormap, revers=False) @@ -1484,7 +1484,7 @@ class NBR(Indice): os.remove(str(out_path / self.indice_raw)) os.remove(str(out_path / self.indice_stem + self.ext_raw_aux)) logger.info("Removing {}".format(self.indice_raw)) - except: + except Exception: pass if quicklook: diff --git a/sen2chain/jobs.py b/sen2chain/jobs.py index aba3c739bb839f2236dc74f679644f218b42c974..277a53debfe046301f58f9e1d86466d6fc233eb3 100644 --- a/sen2chain/jobs.py +++ b/sen2chain/jobs.py @@ -476,19 +476,19 @@ class Job: self.timing = parser["top"]["timing"] try: self.provider = parser["top"]["provider"] - except: + except Exception: self.provider = "peps" try: self.tries = int(parser["top"]["tries"]) - except: + except Exception: self.tries = 1 try: self.sleep = int(parser["top"]["sleep"]) - except: + except Exception: self.sleep = 0 try: self.nb_proc = int(parser["top"]["nb_proc"]) - except: + except Exception: self.nb_proc = 8 try: self.copy_l2a_sideproducts = bool( @@ -496,25 +496,25 @@ class Job: parser["top"]["copy_l2a_sideproducts"] ) ) - except: + except Exception: self.copy_l2a_sideproducts = False try: self.clean_before = bool(setuptools.distutils.util.strtobool( parser["top"]["clean_before"] ) ) - except: + except Exception: self.clean_before = True try: self.clean_after = bool(setuptools.distutils.util.strtobool( parser["top"]["clean_after"] ) ) - except: + except Exception: self.clean_after= True try: self.process_by_line = int(parser["top"]["process_by_line"]) - except: + except Exception: self.process_by_line = 0 max_val = 20 @@ -562,7 +562,7 @@ class Job: self.format_max_clouds() self.check_tasks() break - except: + except Exception: pass def format_cm_indices(self): @@ -690,7 +690,7 @@ class Job: try: pat = re.compile(r"(?P<cm_version>CM00[1-2])") returned_val = pat.match(identifier).groupdict() - except: + except Exception: try: pat = re.compile( r"(?P<cm_version>CM003)" @@ -698,7 +698,7 @@ class Job: + "-ITER(?P<iterations>.*)" ) returned_val = pat.match(identifier).groupdict() - except: + except Exception: try: pat = re.compile( r"(?P<cm_version>CM004)" @@ -709,7 +709,7 @@ class Job: + "-ITER(?P<iterations>.*)" ) returned_val = pat.match(identifier).groupdict() - except: + except Exception: returned_val = { "cm_version": "CM001", "probability": 1, diff --git a/sen2chain/library.py b/sen2chain/library.py index 3be41cd05f3050fef2a044fe369dd78f995fe777..9a488ac3e16fe33e239ca234c86a9f118c3e5a16 100644 --- a/sen2chain/library.py +++ b/sen2chain/library.py @@ -134,7 +134,7 @@ class Library: counts["removed_problems"], ) ) - except: + except Exception: pass return { "identified_problems": nb_id, @@ -168,7 +168,7 @@ class Library: size_tile = til.archive_l1c(size_only=size_only, force=force) if size_only: total_size += size_tile - except: + except Exception: pass logger.info( "Total l1c size to move: {}".format(human_size_decimal(total_size)) @@ -202,7 +202,7 @@ class Library: size_tile = til.archive_l2a(size_only=size_only) if size_only: total_size += size_tile - except: + except Exception: logger.info("Problem while archiving") logger.info( "Total l2a size to move: {}".format(human_size_decimal(total_size)) @@ -234,7 +234,7 @@ class Library: til = Tile(t) size_tile = til.archive_all(size_only=size_only, force=force) total_size += size_tile - except: + except Exception: pass logger.info( "Total size to move: {}".format(human_size_decimal(total_size)) @@ -271,7 +271,7 @@ class Library: try: for tile in self.tiles_l2a: Tile(tile).update_latest_ql() - except: + except Exception: pass # def update_latest_ql(self): diff --git a/sen2chain/multi_processing.py b/sen2chain/multi_processing.py index d8b20896f04e4faa582aed160d35222edf3b6f96..c27d9e5d4524a8fe6fe6e78787d6ddd81a575da6 100644 --- a/sen2chain/multi_processing.py +++ b/sen2chain/multi_processing.py @@ -51,7 +51,7 @@ def multi(product_copyl2asideproducts): logger.info("End {}".format(product)) if l2a_prod.in_library and remove_used_l1c: l1c.remove() - except: + except Exception: logger.info("Plante {}".format(product)) if proc: logger.info("Killing process {}".format(proc.pid)) @@ -86,7 +86,7 @@ def l2a_multiprocessing(process_list, nb_proc=4): # l2a = L2aProduct(l2a_identifier) # try: # l2a.process_cloud_mask_v2() -# except: +# except Exception: # pass # def cld_multiprocessing(process_list, nb_proc=4): @@ -120,7 +120,7 @@ def multi_cld_ver_pro_iter_repro(l2a_ver_pro_iter_repro): thin_cir=thin_cir, reprocess=reprocess, ) - except: + except Exception: pass @@ -165,7 +165,7 @@ def multi_idx(l2a_id_idx): cld_hi_prob=cld_hi_prob, thin_cir=thin_cir, ) - except: + except Exception: pass diff --git a/sen2chain/peps_download3.py b/sen2chain/peps_download3.py index a7ccf7a05247eb308445ba8eb0fa406218c24b82..0094e1f6a48ddd9ed33f6be781cdcd9703df7a3f 100644 --- a/sen2chain/peps_download3.py +++ b/sen2chain/peps_download3.py @@ -88,7 +88,7 @@ def parse_catalog(search_json_file): download_dict[prod] = feature_id storage_dict[prod] = storage size_dict[prod] = size - except: + except Exception: pass return(prod, download_dict, storage_dict, size_dict) @@ -226,7 +226,7 @@ try: if passwd.endswith('\n'): passwd = passwd[:-1] f.close() -except: +except Exception: print("error with password file") sys.exit(-2) diff --git a/sen2chain/products.py b/sen2chain/products.py index d2c6f6f6a8d56b43724134055b3a4e976e8f6f1c..5da6579ab5562cf125412bd6003ae232cb244ad7 100755 --- a/sen2chain/products.py +++ b/sen2chain/products.py @@ -187,7 +187,7 @@ class Product: self._update_metadata_parser() try: return self._metadata_parser.get_band_path(key=key, res=res) - except: + except Exception: return None @property @@ -211,7 +211,7 @@ class Product: def set_permissions(self): try: set_permissions(self.path) - except: + except Exception: logger.info("Cannot set permissions to: {}".format(self.identifier)) class L1cProduct(Product): @@ -416,7 +416,7 @@ class L1cProduct(Product): logger.info("Removing: {}".format(self.path)) try: shutil.rmtree(str(self.path)) - except: + except Exception: logger.error("Cannot remove product: {}".format(self.path)) @property @@ -1129,7 +1129,7 @@ class L2aProduct(Product): # def set_permissions(self): # try: # set_permissions(self.path) - # except: + # except Exception: # logger.info("Cannot set permissions to: {}".format(self.identifier)) # def has_indice(self, indice): @@ -1458,7 +1458,7 @@ class L2aProduct(Product): """old sen2cor snow-mask's name""" # try: return self._get_band_path(key="SNW") - # except: + # except Exception: # logger.warning("'snw_20m deprecated', use: 'msk_snwprb_20m'") # return self.msk_snwprb_20m @@ -1467,7 +1467,7 @@ class L2aProduct(Product): """new sen2cor cloud-mask's name""" # try: return self._get_band_path(key="SNW") - # except: + # except Exception: # return self._get_band_path(key="SNWPRB", res="20m") @property @@ -1475,7 +1475,7 @@ class L2aProduct(Product): """old sen2cor cloud-mask's name""" # try: return self._get_band_path(key="CLD", res="20m") - # Except: + # except Exception: # logger.warning("'cld_20m' deprecated', use: 'msk_cldprb_20m'") # return self.msk_cldprb_20m @@ -1484,7 +1484,7 @@ class L2aProduct(Product): """new sen2cor cloud-mask's name""" # try: # return self._get_band_path(key="MSK_CLDPRB", res="20m") - # except: + # except Exception: return self._get_band_path(key="CLD", res="20m") @property @@ -1783,7 +1783,7 @@ class NewCloudMaskProduct: } ) return val - except: + except Exception: pass try: pat = re.compile( @@ -1803,7 +1803,7 @@ class NewCloudMaskProduct: ) return val - except: + except Exception: pass try: pat = re.compile( @@ -1816,18 +1816,18 @@ class NewCloudMaskProduct: # + ".jp2" ) return pat.match(identifier).groupdict() - except: + except Exception: pass # try: # return re.findall(r"S2.+_(CM004)-CSH(.*)-CMP(.*)-CHP(.*)-TCI(.*)-ITER(.*)\.", identifier)[0] - # except: + # except Exception: # try: # return [re.findall(r"S2.+_(CM003)-PRB(.*)-ITER(.*)\.", identifier)[0], None, None] - # except: + # except Exception: # try: # return [re.findall(r"S2.+_(CM00[1-2]).+", identifier)[0], None, None] - # except: + # except Exception: # return [None, None, None] @property @@ -2156,7 +2156,7 @@ class FamilyProduct(dict): + ").*" ) return pat.match(identifier).groupdict() - except: + except Exception: pass def get_l1c(self): @@ -2191,7 +2191,7 @@ class FamilyProduct(dict): self.cloudmask_string.append(cm_string) cloudmasks.append(cm_dict) self.cloudmask_string = list(set(self.cloudmask_string)) - except: + except Exception: pass return cloudmasks @@ -2223,7 +2223,7 @@ class FamilyProduct(dict): indice_dict["indice_string"] = indice_dict["indice"] indices.append(indice_dict) self.indice_strings = list(set(self.indice_strings)) - except: + except Exception: pass return indices diff --git a/sen2chain/tiles.py b/sen2chain/tiles.py index 0504b650676fef84c0a22df2b8d2f509310eabf0..998d88899a284d7e9acdbf488b38818485a062b9 100644 --- a/sen2chain/tiles.py +++ b/sen2chain/tiles.py @@ -508,7 +508,7 @@ class Tile: "date": Tile._get_date(f.name), "cloud_cover": float(cloud_cover), } - except: + except Exception: logger.info("skipping {}, you can try to redownload this product, but probably metadata issue".format(f.name)) def _get_l2a_list(self) -> None: @@ -534,7 +534,7 @@ class Tile: "date": date, "cloud_cover": float(cloud_cover), } - except: + except Exception: logger.info("skipping {}, you can try to redownload and compute this product".format(f.name)) @@ -871,7 +871,7 @@ class Tile: human_size(total - local), ) ) - except: + except Exception: pass try: local = getFolderSize(str(self.paths["l2a"])) @@ -883,7 +883,7 @@ class Tile: human_size(total - local), ) ) - except: + except Exception: pass try: local = getFolderSize(str(self.paths["cloudmasks"])) @@ -895,7 +895,7 @@ class Tile: human_size(total - local), ) ) - except: + except Exception: pass for indice, path in self._paths["indices"].items(): logger.info( @@ -966,7 +966,7 @@ class Tile: ) .products } - except: + except Exception: logger.info("Problem finding missing indices setting all L2A list") missings_indice_set = set(self.l2a.products) @@ -1077,7 +1077,7 @@ class Tile: while True: try: dag.download(q.get()) - except: + except Exception: import traceback logger.error(traceback.format_exc()) #TODO should cleanup the tile @@ -1265,7 +1265,7 @@ class Tile: while True: try: dag.download(q.get()) - except: + except Exception: import traceback logger.error(traceback.format_exc()) #TODO should cleanup the tile @@ -1706,7 +1706,7 @@ class Tile: shutil.rmtree(str(f)) logger.info("Removing {} from L1C folder".format(f.name)) nb_rm += 1 - except: + except Exception: logger.error( "Can't remove {} from L1C folder".format(f.name) ) @@ -1725,7 +1725,7 @@ class Tile: f.unlink() logger.info("Removing {} from L1C folder".format(f.name)) nb_rm += 1 - # except: + # except Exception: # logger.error( # "Can't remove {} from L1C folder".format(f.name) # ) @@ -1746,7 +1746,7 @@ class Tile: shutil.rmtree(str(f)) logger.info("Removing {} folder from L1C folder".format(f.name)) nb_rm += 1 - except: + except Exception: logger.error( "Can't remove {} from L1C folder".format(f.name) ) @@ -1771,7 +1771,7 @@ class Tile: shutil.rmtree(str(f)) logger.info("Removing {} folder from L2A folder".format(f.name)) nb_rm += 1 - except: + except Exception: logger.error( "Can't remove {} from L2A folder".format(f.name) ) @@ -1799,7 +1799,7 @@ class Tile: ) ) nb_rm += 1 - except: + except Exception: logger.error( "Can't remove {} from L2A folder".format(f.name) ) @@ -1822,7 +1822,7 @@ class Tile: logger.info("Removing {} from L1C folder".format(e)) shutil.rmtree(str(e)) nb_rm += 1 - except: + except Exception: logger.error("Can't remove {} from L1C folder".format(e)) # identify 0B cloud masks diff --git a/sen2chain/time_series.py b/sen2chain/time_series.py index 6d50a7cd63bc8cc3d3fafc92fd22cf6981408385..91439ad425c6366407489c760556b389a6ad357a 100644 --- a/sen2chain/time_series.py +++ b/sen2chain/time_series.py @@ -267,7 +267,7 @@ class TimeSeries: # logger.info(stats_cld) try: nbcld = stats["nodata"] - stats_cld["nodata"] - except: + except Exception: nbcld = 0 # logger.info(stats_cld) @@ -763,7 +763,7 @@ class TimeSeries: plt.savefig(str(png_path_nonan)) plt.close() logger.info("Plot saved to png: {}".format(png_path_nonan)) - except: + except Exception: logger.info("No data to plot (no date with 0 nodata)") pass diff --git a/sen2chain/utils.py b/sen2chain/utils.py index 7a4e5ea813f1c48d5813c641b2662a1f8d66abe8..de802a5dc8cef1441900cc29c78e457dfa6cbe2e 100644 --- a/sen2chain/utils.py +++ b/sen2chain/utils.py @@ -113,7 +113,7 @@ def getFolderSize(folder, follow_symlinks=False): follow_symlinks or not os.path.islink(itempath) ): total_size += getFolderSize(itempath) - except: + except Exception: pass return total_size @@ -291,7 +291,7 @@ def get_cm_dict(identifier) -> dict: pat = re.compile(r".*(?P<cm_version>CM00[1-2])") returned_val = pat.match(identifier).groupdict() - except: + except Exception: try: pat = re.compile( r".*(?P<cm_version>CM003)" @@ -300,7 +300,7 @@ def get_cm_dict(identifier) -> dict: ) returned_val = pat.match(identifier).groupdict() - except: + except Exception: try: pat = re.compile( r".*(?P<cm_version>CM004)" @@ -311,7 +311,7 @@ def get_cm_dict(identifier) -> dict: + "-ITER(?P<iterations>.*)" ) returned_val = pat.match(identifier).groupdict() - except: + except Exception: pass if returned_val: