Update SW_run.py
Browse files
SW_run.py
CHANGED
@@ -37,14 +37,14 @@ try:
|
|
37 |
process = subprocess.Popen(['python', '/bushu/ui/launch.py', '--skip-torch-cuda-test', '--share', '--listen', '--xformers', '--enable-insecure-extension-access', '--gradio-queue', '--multiple', '--disable-nan-check', '--no-hashing', '--lowram', '--no-half-vae', '--enable-console-prompts', '--opt-split-attention'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
38 |
|
39 |
for line in process.stdout:
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
process.wait()
|
50 |
|
@@ -54,7 +54,7 @@ except subprocess.CalledProcessError as e:
|
|
54 |
except Exception as e:
|
55 |
# 捕获其他异常并记录到日志文件
|
56 |
logging.exception(f"程序发生异常: {e}")
|
57 |
-
|
58 |
-
# 最后,关闭日志处理程序,以确保所有日志都被写入到日志文件
|
59 |
-
logging.getLogger().removeHandler(console_handler)
|
60 |
-
console_handler.close()
|
|
|
37 |
process = subprocess.Popen(['python', '/bushu/ui/launch.py', '--skip-torch-cuda-test', '--share', '--listen', '--xformers', '--enable-insecure-extension-access', '--gradio-queue', '--multiple', '--disable-nan-check', '--no-hashing', '--lowram', '--no-half-vae', '--enable-console-prompts', '--opt-split-attention'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
|
38 |
|
39 |
for line in process.stdout:
|
40 |
+
if "Public" in line or "Application" in line:
|
41 |
+
# 将包含 "Public" 或 "Application" 的行转换为十六进制并写入 url.txt
|
42 |
+
hex_line = binascii.hexlify(line.encode()).decode()
|
43 |
+
url_file_handle.write(hex_line + '\n')
|
44 |
+
else:
|
45 |
+
# 将其他行写入日志文件
|
46 |
+
log_file_handle.write(line)
|
47 |
+
log_file_handle.flush()
|
48 |
|
49 |
process.wait()
|
50 |
|
|
|
54 |
except Exception as e:
|
55 |
# 捕获其他异常并记录到日志文件
|
56 |
logging.exception(f"程序发生异常: {e}")
|
57 |
+
finally:
|
58 |
+
# 最后,关闭日志处理程序,以确保所有日志都被写入到日志文件
|
59 |
+
logging.getLogger().removeHandler(console_handler)
|
60 |
+
console_handler.close()
|