Python - BadZipFile Error

헨도·2023년 2월 2일
0

Python

목록 보기
11/12
post-thumbnail

Python

오류 내용

BadZipFile : File is not a zip file

오류가 난 코드 부분

xlsx_wb = openpyxl.load_workbook(filename = BytesIO(order_response.content))
xlsx_rows = xlsx_wb.get_sheet_by_name("Sheet1").rows

오류 원인

편집할 엑셀에서 데이터가 존재하지 않을 시, 발생하는 에러

오류 잡기

날짜별로 엑셀 데이터 유무가 나눠지는 상황에서 try, except 구문을 사용하여,
에러는 pass하고, 데이터가 있을 시에만 다음 동작을 하게끔 분기점을 나누어 작업하였다.

profile
Junior Backend Developer

0개의 댓글