add catch error
Showing
1 changed file
with
4 additions
and
0 deletions
| ... | @@ -379,6 +379,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -379,6 +379,7 @@ class Command(BaseCommand, LoggerMixin): |
| 379 | else: | 379 | else: |
| 380 | wb = Workbook() | 380 | wb = Workbook() |
| 381 | for result in result_list: | 381 | for result in result_list: |
| 382 | try: | ||
| 382 | sheet_name, head_fields = self.sheet_content[result[self.CLASSIFY_KEY]] | 383 | sheet_name, head_fields = self.sheet_content[result[self.CLASSIFY_KEY]] |
| 383 | row = [] | 384 | row = [] |
| 384 | for field in head_fields: | 385 | for field in head_fields: |
| ... | @@ -389,6 +390,9 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -389,6 +390,9 @@ class Command(BaseCommand, LoggerMixin): |
| 389 | ws = wb.create_sheet(sheet_name) | 390 | ws = wb.create_sheet(sheet_name) |
| 390 | ws.append(head_fields) | 391 | ws.append(head_fields) |
| 391 | ws.append(row) | 392 | ws.append(row) |
| 393 | except Exception as e: | ||
| 394 | self.folder_log.info('{0} [daily wb failed] [result={1}] [error={2}]'.format( | ||
| 395 | self.log_base, result, traceback.format_exc())) | ||
| 392 | wb.save(wb_path) | 396 | wb.save(wb_path) |
| 393 | 397 | ||
| 394 | def folder_process(self, input_dir, classify, result_queue): | 398 | def folder_process(self, input_dir, classify, result_queue): | ... | ... |
-
Please register or sign in to post a comment