fix: replace bare except with except Exception
Bare except clauses catch all exceptions including SystemExit and KeyboardInterrupt. Replace with except Exception in image validation functions (tfcv.py, pytorchcv.py) for ConvNets and TransferLearning.
This commit is contained in:
parent
33e781bf7b
commit
2a066be892
|
|
@ -134,7 +134,7 @@ def check_image(fn):
|
|||
im = Image.open(fn)
|
||||
im.verify()
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def check_image_dir(path):
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ def check_image(fn):
|
|||
im = Image.open(fn)
|
||||
im.verify()
|
||||
return im.format=='JPEG'
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def check_image_dir(path):
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ def check_image(fn):
|
|||
im = Image.open(fn)
|
||||
im.verify()
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def check_image_dir(path):
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ def check_image(fn):
|
|||
im = Image.open(fn)
|
||||
im.verify()
|
||||
return im.format=='JPEG'
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def check_image_dir(path):
|
||||
|
|
|
|||
Loading…
Reference in New Issue