BBrother commited on
Commit
553eb04
·
1 Parent(s): e32cbee

Update SW_run.py

Browse files
Files changed (1) hide show
  1. SW_run.py +6 -6
SW_run.py CHANGED
@@ -6,12 +6,12 @@ import binascii # 用于将文本转换为十六进制
6
  import re # 用于正则表达式
7
 
8
  # 检查是否存在 logs_run.txt 文件,如果存在则删除它
9
- log_file = '/bushu/logs_run.txt'
10
  if os.path.exists(log_file):
11
  os.remove(log_file)
12
 
13
  # 检查是否存在 url.txt 文件,如果存在则删除它
14
- url_file = '/bushu/url.txt'
15
  if os.path.exists(url_file):
16
  os.remove(url_file)
17
 
@@ -29,13 +29,13 @@ logging.getLogger().addHandler(console_handler)
29
  sys.stdout = logging.getLogger().handlers[0].stream
30
  sys.stderr = logging.getLogger().handlers[0].stream
31
 
32
- # 更改当前工作目录为 /bushu/ui
33
- os.chdir('/bushu/ui')
34
 
35
  try:
36
- # 在 try 块中运行 /bushu/ui/launch.py,并将输出重定向到日志文件
37
  with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
38
- process = subprocess.Popen(['python', '/bushu/ui/launch.py', '--port 7861'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
39
 
40
  url_pattern = re.compile(r'https?://\S+')
41
 
 
6
  import re # 用于正则表达式
7
 
8
  # 检查是否存在 logs_run.txt 文件,如果存在则删除它
9
+ log_file = '/etc/logs_run.txt'
10
  if os.path.exists(log_file):
11
  os.remove(log_file)
12
 
13
  # 检查是否存在 url.txt 文件,如果存在则删除它
14
+ url_file = '/etc/url.txt'
15
  if os.path.exists(url_file):
16
  os.remove(url_file)
17
 
 
29
  sys.stdout = logging.getLogger().handlers[0].stream
30
  sys.stderr = logging.getLogger().handlers[0].stream
31
 
32
+ # 更改当前工作目录为 /etc/main
33
+ os.chdir('/etc/main')
34
 
35
  try:
36
+ # 在 try 块中运行 /etc/main/launch.py,并将输出重定向到日志文件
37
  with open(log_file, 'a') as log_file_handle, open(url_file, 'a') as url_file_handle:
38
+ process = subprocess.Popen(['python', '/etc/main/webui.py', qidong], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
39
 
40
  url_pattern = re.compile(r'https?://\S+')
41