Difficult-Rocket/DR.py

69 lines
1.9 KiB
Python
Raw Normal View History

2021-09-23 23:29:50 +08:00
"""
2020-11-28 15:17:44 +08:00
writen by shenjackyuanjie
mail: 3695888@qq.com
2021-02-16 11:35:10 +08:00
"""
2021-05-24 22:28:42 +08:00
import os
import sys
2021-08-13 12:25:29 +08:00
import traceback
import threading
import multiprocessing
2021-05-24 22:28:42 +08:00
2021-11-04 23:32:05 +08:00
# TODO 默认位置配置文件
# TODO 可自定义工作路径
2021-05-24 22:28:42 +08:00
2021-08-24 22:31:52 +08:00
hi = """Difficult Rocket is writen by shenjackyuanjie
mail: 3695888@qq.com or shyj3695888@163.com
QQ: 3695888"""
2021-10-01 23:12:01 +08:00
error_format = {
'TestError': '游戏正在调试中,某处引发了一个 TestError不是bug造成的原因',
'AssertionError': '游戏的某处检查未通过情报告issue',
'error.unknown': '游戏报错了现在输出报错信息请报告issue',
'error.happen': '游戏出现了一个报错!正在处理'
}
2021-02-16 11:35:10 +08:00
if __name__ == '__main__':
2021-10-01 23:12:01 +08:00
print(f'{__file__=}')
print(f'{sys.path[0]=}')
print(f'{sys.argv[0]=}')
print(f'{os.getcwd()=}')
print(f'{os.path.abspath(__file__)=}')
print(f'{os.path.realpath(__file__)=}')
# 输出一遍大部分文件位置相关信息 以后可能会加到logs里
file_path = os.path.split(os.path.realpath(__file__))[0]
os.chdir(file_path)
sys.path.append(f'{file_path}/Difficult_Rocket')
sys.path.append(f'{file_path}/libs')
print(sys.path)
print(hi)
2021-09-16 19:18:06 +08:00
DEBUGGING = False
from SRtool.api.Exp import *
2022-03-22 23:20:07 +08:00
try:
from SRtool.crash import crash
from SRtool import main
2022-03-22 23:20:07 +08:00
game = main.Game()
game.start()
2021-09-16 19:18:06 +08:00
if DEBUGGING:
raise TestError('debugging')
except Exception as exp:
from SRtool.translate import tr
print(error_format['error.happen'])
2021-08-13 12:25:29 +08:00
error = traceback.format_exc()
2021-10-28 06:43:35 +08:00
name = type(exp).__name__
if name in error_format:
2021-10-01 23:12:01 +08:00
print(error_format[name])
else:
print(error_format['error.unknown'])
2021-08-13 12:25:29 +08:00
print(error)
2021-09-16 19:18:06 +08:00
crash.create_crash_report(error)
2021-09-05 00:50:05 +08:00
else:
2021-09-08 23:38:34 +08:00
crash.record_thread = False
print(crash.all_thread)
print(crash.all_process)