Difficult-Rocket/Difficult_Rocket.py

51 lines
1.6 KiB
Python
Raw Normal View History

2021-02-16 11:35:10 +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
"""
2020-11-28 15:17:44 +08:00
2021-05-24 22:28:42 +08:00
import os
import sys
2021-08-13 12:25:29 +08:00
import traceback
2021-09-02 22:47:10 +08:00
import threading
2021-05-24 22:28:42 +08:00
2021-08-24 22:31:52 +08:00
# 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-02-16 11:35:10 +08:00
if __name__ == '__main__':
2021-05-31 06:05:31 +08:00
print("sys.path[0] = ", sys.path[0])
print("sys.argv[0] = ", sys.argv[0])
print("__file__ = ", __file__)
print("os.path.abspath(__file__) = ", os.path.abspath(__file__))
print("os.path.realpath(__file__) = ", os.path.realpath(__file__))
2021-08-24 22:31:52 +08:00
print("os.path.dirname(os.path.realpath(__file__)) = ", os.path.dirname(os.path.realpath(__file__)))
print("os.path.split(os.path.realpath(__file__)) = ", os.path.split(os.path.realpath(__file__)))
print("os.path.split(os.path.realpath(__file__))[0] = ", os.path.split(os.path.realpath(__file__))[0])
2021-05-31 06:05:31 +08:00
print("os.getcwd() = ", os.getcwd())
2021-06-26 14:15:33 +08:00
os.chdir(sys.path[0]) # TODO 没做完.ing
2021-09-05 00:50:05 +08:00
sys.path.append('Difficult_Rocket')
sys.path.append('Difficult_Rocket/libs')
2021-08-24 22:31:52 +08:00
2021-03-24 23:37:10 +08:00
print(hi)
2021-08-13 12:25:29 +08:00
try:
2021-09-08 23:38:34 +08:00
from Difficult_Rocket import crash
2021-09-09 23:54:03 +08:00
from Difficult_Rocket import main
2021-09-05 00:50:05 +08:00
2021-08-13 12:25:29 +08:00
game = main.Game()
game.start()
2021-09-05 00:50:05 +08:00
except:
2021-09-02 22:47:10 +08:00
print('the game has error , now outputting error message')
2021-08-13 12:25:29 +08:00
error = traceback.format_exc()
print(error)
2021-09-08 23:38:34 +08:00
from Difficult_Rocket.api import thread
2021-09-05 00:50:05 +08:00
2021-09-08 23:38:34 +08:00
crash_thread = thread.Threads(target=crash.create_crash_report, args=(error,), name='Crash report thread')
2021-09-02 22:47:10 +08:00
crash_thread.start()
2021-09-05 00:50:05 +08:00
crash_thread.join()
else:
2021-09-08 23:38:34 +08:00
crash.record_thread = False
print(crash.all_thread)