From ca24212f2d9a74ca7718ffa5170e775f1cf0737a Mon Sep 17 00:00:00 2001 From: Bohdan Date: Wed, 16 Oct 2019 13:35:51 +0300 Subject: [PATCH] change try block to if check --- wrapper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wrapper.py b/wrapper.py index 404e704..220f195 100644 --- a/wrapper.py +++ b/wrapper.py @@ -89,11 +89,10 @@ def analyzer(self): self.last_take_time = time() list_of_files = glob.glob('{}/*.jpg'.format(self.dir_name)) # * means all if need specific format then *.csv - try: - latest_file_in_dir = max(list_of_files, key=os.path.getctime) - except ValueError as e: + if not list_of_files: print('No file') continue + latest_file_in_dir = max(list_of_files, key=os.path.getctime) file_name = latest_file_in_dir.split('\\')[-1] if last_file == file_name: print('No new file')