BBrother commited on
Commit
cffe9cc
1 Parent(s): 4e4c7ac

Update SW_run.py

Browse files
Files changed (1) hide show
  1. SW_run.py +5 -2
SW_run.py CHANGED
@@ -4,7 +4,7 @@ import logging
4
  import os
5
 
6
  # 检查是否存在 logs_run.txt 文件,如果存在则删除它
7
- log_file = '/content/logs_run.txt'
8
  if os.path.exists(log_file):
9
  os.remove(log_file)
10
 
@@ -22,10 +22,13 @@ logging.getLogger().addHandler(console_handler)
22
  sys.stdout = logging.getLogger().handlers[0].stream
23
  sys.stderr = logging.getLogger().handlers[0].stream
24
 
 
 
 
25
  try:
26
  # 在try块中运行v2_3.py,并将输出重定向到日志文件
27
  with open(log_file, 'a') as log_file_handle:
28
- subprocess.run(['python', 'v2_3.py'], check=True, stdout=log_file_handle, stderr=subprocess.STDOUT)
29
  except subprocess.CalledProcessError as e:
30
  # 捕获异常并记录到日志文件
31
  logging.exception(f"程序发生异常: {e}")
 
4
  import os
5
 
6
  # 检查是否存在 logs_run.txt 文件,如果存在则删除它
7
+ log_file = '/bushu/logs_run.txt'
8
  if os.path.exists(log_file):
9
  os.remove(log_file)
10
 
 
22
  sys.stdout = logging.getLogger().handlers[0].stream
23
  sys.stderr = logging.getLogger().handlers[0].stream
24
 
25
+ # 切换到/bushu/ui目录
26
+ subprocess.run(["cd", "/bushu/ui"], shell=True)
27
+
28
  try:
29
  # 在try块中运行v2_3.py,并将输出重定向到日志文件
30
  with open(log_file, 'a') as log_file_handle:
31
+ subprocess.run(['python', 'launch.py'], check=True, stdout=log_file_handle, stderr=subprocess.STDOUT)
32
  except subprocess.CalledProcessError as e:
33
  # 捕获异常并记录到日志文件
34
  logging.exception(f"程序发生异常: {e}")