代码拉取完成,页面将自动刷新
同步操作将从 执明神君/DD_Monitor_latest 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
"""
异常捕获器
"""
import os, sys, time, datetime, subprocess, logging, traceback, platform
# from PySide6.Qt import *
def uncaughtExceptionHandler(exctype, value, tb):
logging.error("\n************!!!UNCAUGHT EXCEPTION!!!*********************\n" +
("Type: %s" % exctype) + '\n' +
("Value: %s" % value) + '\n' +
("Traceback:" + '\n') +
" ".join(traceback.format_tb(tb)) +
"************************************************************\n")
showFaultDialog(err_type=exctype, err_value=value, tb=tb)
def unraisableExceptionHandler(exc_type,exc_value,exc_traceback,err_msg,object):
logging.error("\n************!!!UNHANDLEABLE EXCEPTION!!!******************\n" +
("Type: %s" % exc_type) + '\n' +
("Value: %s" % exc_value) + '\n' +
("Message: %s " % err_msg) + '\n' +
("Traceback:" + '\n') +
" ".join(traceback.format_tb(exc_traceback)) + '\n' +
("On Object: %s" + object) + '\n' +
"************************************************************\n")
showFaultDialog(err_type=exc_type, err_value=exc_value, tb=exc_traceback)
def thraedingExceptionHandler(exc_type,exc_value,exc_traceback,thread):
logging.error("\n************!!!UNCAUGHT THREADING EXCEPTION!!!***********\n" +
("Type: %s" % exc_type) + '\n' +
("Value: %s" % exc_value) + '\n' +
("Traceback on thread %s: " % thread + '\n') +
" ".join(traceback.format_tb(exc_traceback)) +
"************************************************************\n")
showFaultDialog(err_type=exc_type, err_value=exc_value, tb=exc_traceback)
def loggingSystemInfo():
systemCmd = ""
gpuCmd = ""
if platform.system() == 'Windows':
systemCmd = r"\u C:\Windows\System32\systeminfo.exe"
wmi_exe = r"C:\Windows\System32\wbem\WMIC.exe"
# cmd 下运行 "wmic PATH win32_VideoController GET /?" 查看可查询的参数列表
gpu_property_list = "AdapterCompatibility, Caption, DeviceID, DriverDate, DriverVersion, VideoModeDescription"
gpuCmd = f"{wmi_exe} PATH win32_VideoController GET {gpu_property_list} /FORMAT:list"
elif platform.system() == 'Darwin':
systemCmd = "/usr/sbin/system_profiler SPHardwareDataType"
gpuCmd = "/usr/sbin/system_profiler SPDisplaysDataType"
elif platform.system() == 'Linux':
systemCmd = "/usr/bin/lscpu"
gpuCmd = "/usr/bin/lspci"
systemInfoProcess = subprocess.Popen(systemCmd, shell=True, stdout=subprocess.PIPE,universal_newlines=True)
systemInfoProcessReturn = systemInfoProcess.stdout.read()
gpuInfoProcess = subprocess.Popen(gpuCmd, shell=True, stdout=subprocess.PIPE, universal_newlines=True)
gpuInfoProcessReturn = gpuInfoProcess.stdout.read()
if platform.system() == 'Windows':
gpuInfoProcessReturn = gpuInfoProcessReturn.strip()
gpuInfoProcessReturn = gpuInfoProcessReturn.replace("\n\n", "\n")
logging.info(f"系统信息: \n{systemInfoProcessReturn}")
logging.info(f"GPU信息: \n{gpuInfoProcessReturn}")
def showFaultDialog(err_type, err_value, tb):
return None # 跳过报错 没精力改了
msg = QMessageBox()
msg.setIcon(QMessageBox.Critical)
msg.setText("不好,出现了一个问题: %s" % err_type)
msg.setInformativeText("运行中出现了%s故障,日志已保存在logs文件夹中的log-%s.txt文件内。" % (err_value, datetime.datetime.today().strftime('%Y-%m-%d')))
msg.setWindowTitle("DD监控室出现了问题")
msg.setDetailedText("Traceback:\n%s" % (" ".join(traceback.format_tb(tb))))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec_()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。