From a28c564fca9b5adb3b4b2a07fef72e07481cca43 Mon Sep 17 00:00:00 2001 From: KWON Date: Mon, 30 Jun 2025 12:44:52 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=ED=9B=84=20thumb.jpg=20=EA=B9=8C=EC=A7=80=20?= =?UTF-8?q?=EA=B0=99=EC=9D=B4=20=EC=82=AD=EC=A0=9C=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/gnu_autoupload.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/gnu_autoupload.py b/data/gnu_autoupload.py index 5ef1981..fcf229d 100644 --- a/data/gnu_autoupload.py +++ b/data/gnu_autoupload.py @@ -135,7 +135,7 @@ def write_board(board, subject, content, mb_id, nickname, ca_name=None, file_lis size, width, height, img_type, now)) file_count += 1 else: - print(f"[경고] 파일 업로드 실패: {file}") + raise Exception(f"[FTP 오류] 파일 업로드 실패: {file}") curs.execute(f"UPDATE g5_write_{board} SET wr_file = %s WHERE wr_id = %s", (file_count, wr_id)) conn.commit() @@ -143,7 +143,11 @@ def write_board(board, subject, content, mb_id, nickname, ca_name=None, file_lis except Exception as e: conn.rollback() - print(f"[DB 오류] {type(e).__name__}: {e}") + if "[FTP 오류]" in str(e): + print(f"[FTP 오류] {e}") + else: + print(f"[DB 오류] {type(e).__name__}: {e}") + raise finally: conn.close() @@ -186,6 +190,7 @@ def main(): ) try: + # weather_file만 삭제, thumb.jpg는 삭제하지 않음 if os.path.isfile(weather_file): os.remove(weather_file) print(f"[정리 완료] 캡처 이미지 삭제됨: {weather_file}") @@ -193,5 +198,6 @@ def main(): print(f"[삭제 오류] {type(e).__name__}: {e}") + if __name__ == "__main__": main()