BBrother commited on
Commit
6277d0e
·
1 Parent(s): 731d8ff

Update SW_run.py

Browse files
Files changed (1) hide show
  1. SW_run.py +3 -6
SW_run.py CHANGED
@@ -27,13 +27,10 @@ logging.getLogger().addHandler(console_handler)
27
  sys.stdout = logging.getLogger().handlers[0].stream
28
  sys.stderr = logging.getLogger().handlers[0].stream
29
 
30
- # 切换到/bushu/ui目录
31
- subprocess.run(["cd", "/bushu/ui"], shell=True)
32
-
33
  try:
34
- # try 块中运行 launch.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, bufsize=1)
37
  for line in iter(process.stdout.readline, ''):
38
  if "Running on" in line:
39
  # 如果日志行包含 "Running on",将它写入 url.txt 文件
@@ -54,4 +51,4 @@ except Exception as e:
54
  finally:
55
  # 最后,关闭日志处理程序,以确保所有日志都被写入到日志文件
56
  logging.getLogger().removeHandler(console_handler)
57
- console_handler.close()
 
27
  sys.stdout = logging.getLogger().handlers[0].stream
28
  sys.stderr = logging.getLogger().handlers[0].stream
29
 
 
 
 
30
  try:
31
+ # 直接运行 launch.py 文件,并将输出重定向到日志文件
32
  with open(log_file, 'a') as log_file_handle:
33
+ process = subprocess.Popen(['python', '/bushu/ui/launch.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, bufsize=1)
34
  for line in iter(process.stdout.readline, ''):
35
  if "Running on" in line:
36
  # 如果日志行包含 "Running on",将它写入 url.txt 文件
 
51
  finally:
52
  # 最后,关闭日志处理程序,以确保所有日志都被写入到日志文件
53
  logging.getLogger().removeHandler(console_handler)
54
+ console_handler.close()