From b65765e670e3fadd68ef9e2310bcacd31488cc45 Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Mon, 24 Nov 2025 18:53:10 +0800 Subject: [PATCH] 1 --- script/factory_sliceing/download_print_out.py | 6 +++--- script/factory_sliceing/type_setting_order.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/factory_sliceing/download_print_out.py b/script/factory_sliceing/download_print_out.py index 2e00c6c..ff5a212 100644 --- a/script/factory_sliceing/download_print_out.py +++ b/script/factory_sliceing/download_print_out.py @@ -198,15 +198,15 @@ def read_pids_from_json(pid_file): # 检查JSON文件是否存在 if not os.path.exists(json_path): print(f"错误: JSON文件不存在 - {json_path}") - return [] + return [], {} # 读取JSON文件 try: - with open(json_path, 'r') as f: + with open(json_path, 'r', encoding='utf-8') as f: data = json.load(f) except Exception as e: print(f"读取JSON文件失败: {e}") - return [] + return [], {} list_model_info = [] # 处理每个模型 diff --git a/script/factory_sliceing/type_setting_order.py b/script/factory_sliceing/type_setting_order.py index 31046c0..dac7049 100644 --- a/script/factory_sliceing/type_setting_order.py +++ b/script/factory_sliceing/type_setting_order.py @@ -82,10 +82,10 @@ def step1(versionId): if not ossClient().object_exists(jsonFilePath): return False #下载文件到项目所在目录 - dirNow = currentDir + '/batchPrint/' + versionId + '/json' + dirNow = os.path.join(currentDir, 'batchPrint', versionId, 'json') if not os.path.exists(dirNow): os.makedirs(dirNow) - localFilePath = dirNow + '/' + versionId + '.json' + localFilePath = os.path.join(dirNow, f'{versionId}.json') ossClient().get_object_to_file(jsonFilePath, localFilePath) return True @@ -141,7 +141,7 @@ def main(work_dir=None): print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} JSON文件下载数据失败,等待10秒') time.sleep(10) continue - jsonFilePath = currentDir + '/batchPrint/' + versionId + '/json/' + versionId + '.json' + jsonFilePath = os.path.join(currentDir, 'batchPrint', versionId, 'json', f'{versionId}.json') step2(jsonFilePath, versionId) print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 数据处理完成,等待10秒') requestApiToUpdateSliceStatus(versionId)