acecalisto3 commited on
Commit
5e4b404
·
verified ·
1 Parent(s): 3f41c3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -253,6 +253,10 @@ class FileProcessor:
253
  """Process a zip file and extract its contents"""
254
  dataset = []
255
  try:
 
 
 
 
256
  with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
257
  zip_ref.extractall(extract_to)
258
  for file_info in zip_ref.infolist():
@@ -260,6 +264,8 @@ class FileProcessor:
260
  continue
261
  extracted_file_path = os.path.join(extract_to, file_info.filename)
262
  dataset.extend(self._process_single_file(open(extracted_file_path, 'rb')))
 
 
263
  except Exception as e:
264
  logger.error(f"Error processing zip file: {e}")
265
  return dataset
 
253
  """Process a zip file and extract its contents"""
254
  dataset = []
255
  try:
256
+ if not os.path.isfile(zip_file_path):
257
+ logger.error(f"Zip file does not exist: {zip_file_path}")
258
+ return dataset
259
+
260
  with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
261
  zip_ref.extractall(extract_to)
262
  for file_info in zip_ref.infolist():
 
264
  continue
265
  extracted_file_path = os.path.join(extract_to, file_info.filename)
266
  dataset.extend(self._process_single_file(open(extracted_file_path, 'rb')))
267
+ except FileNotFoundError as e:
268
+ logger.error(f"File not found: {e}")
269
  except Exception as e:
270
  logger.error(f"Error processing zip file: {e}")
271
  return dataset