From 22d50941970899b6089c14d657e7df0533995e87 Mon Sep 17 00:00:00 2001 From: Stitch-z <284618289@qq.com> Date: Tue, 24 Oct 2023 14:17:54 +0800 Subject: [PATCH] update: optimized code. --- metagpt/actions/invoice_ocr.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metagpt/actions/invoice_ocr.py b/metagpt/actions/invoice_ocr.py index 2532543d9..b37aa6885 100644 --- a/metagpt/actions/invoice_ocr.py +++ b/metagpt/actions/invoice_ocr.py @@ -71,9 +71,8 @@ class InvoiceOCR(Action): # Use CP437 to encode the file name, and then use GBK decoding to prevent Chinese garbled code relative_name = Path(zip_info.filename.encode("cp437").decode("gbk")) if relative_name.suffix: - name = relative_name.name full_filename = file_directory / relative_name - await File.write(full_filename.parent, name, zip_ref.read(zip_info.filename)) + await File.write(full_filename.parent, relative_name.name, zip_ref.read(zip_info.filename)) logger.info(f"unzip_path: {file_directory}") return file_directory