BBrother commited on
Commit
4249357
1 Parent(s): a3ddf5f

Update SW_run.py

Browse files
Files changed (1) hide show
  1. SW_run.py +3 -3
SW_run.py CHANGED
@@ -32,17 +32,17 @@ subprocess.run(["cd", "/bushu/ui"], shell=True)
32
 
33
  try:
34
  # 在try块中运行v2_3.py,并将输出重定向到日志文件
35
- with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
36
  process = subprocess.Popen(['python', 'launch.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
37
  for line in process.stdout:
38
  if "Running on" in line:
39
  # 如果日志行包含 "Running on",将它写入 url.txt 文件
40
- url_file_handle.write(line)
 
41
  else:
42
  # 否则,将日志行写入 logs_run.txt 文件
43
  log_file_handle.write(line)
44
  log_file_handle.flush()
45
- url_file_handle.flush()
46
  process.wait()
47
  except subprocess.CalledProcessError as e:
48
  # 捕获异常并记录到日志文件
 
32
 
33
  try:
34
  # 在try块中运行v2_3.py,并将输出重定向到日志文件
35
+ with open(log_file, 'a') as log_file_handle:
36
  process = subprocess.Popen(['python', 'launch.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
37
  for line in process.stdout:
38
  if "Running on" in line:
39
  # 如果日志行包含 "Running on",将它写入 url.txt 文件
40
+ with open(url_file, 'a') as url_file_handle:
41
+ url_file_handle.write(line)
42
  else:
43
  # 否则,将日志行写入 logs_run.txt 文件
44
  log_file_handle.write(line)
45
  log_file_handle.flush()
 
46
  process.wait()
47
  except subprocess.CalledProcessError as e:
48
  # 捕获异常并记录到日志文件