1、错误控制:文件不存在、sif计算失败;

2、监控某一目录,并将新生成的csv文件上传到ftp服务器;
This commit is contained in:
tangchao0503
2025-10-11 15:11:48 +08:00
parent d15edc0f8b
commit dcd9c76ddd
2 changed files with 136 additions and 0 deletions

View File

@ -202,6 +202,8 @@ class CSVFileHandler(FileSystemEventHandler):
# 上传多个文件
success_count = 0
for file_path in file_paths:
if not os.path.exists(file_path):
continue
try:
filename = os.path.basename(file_path)
with open(file_path, "rb") as f:
@ -451,6 +453,7 @@ class CSVFileHandler(FileSystemEventHandler):
command_str_sfm = program_path + " " + standard_sif_path + " " + input_path + " " + output_path_sfm + " " + param_sfm
return_code = os.system(command_str_3fld)
print(command_str_3fld)
return_code = os.system(command_str_sfld)
return_code = os.system(command_str_sfm)
print(f"命令返回状态码: {return_code}")
@ -458,6 +461,9 @@ class CSVFileHandler(FileSystemEventHandler):
return output_path_3fld, output_path_sfld, output_path_sfm
def add_validity_column_to_file(self, file_path, quality_level):
if not os.path.exists(file_path):
return
# 创建临时文件
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, newline='')