From f47adc68ba01103a59b28c9cee614ad1a0c4cc71 Mon Sep 17 00:00:00 2001 From: "xxai.art" Date: Fri, 2 Jun 2023 14:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- onnx/export/tar.bz2.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/onnx/export/tar.bz2.py b/onnx/export/tar.bz2.py index 896b2cbc..d71ebddf 100755 --- a/onnx/export/tar.bz2.py +++ b/onnx/export/tar.bz2.py @@ -7,15 +7,12 @@ def txz(folder_path, output_path): - # 创建.tar文件流 - tar_stream = bz2.BZ2File(output_path, 'w') + stream = bz2.BZ2File(output_path, 'w') - # 将文件夹压缩为.tar文件流 - with tarfile.TarFile(fileobj=tar_stream, mode='w') as tar: - tar.add(folder_path, arcname='') + with tarfile.TarFile(fileobj=stream, mode='w') as tar: + tar.add(folder_path, arcname='') - # 关闭.tar文件流 - tar_stream.close() + stream.close() txz(ONNX_DIR, ONNX_DIR + '.tar.bz2')