-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (37 loc) · 911 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import config_loader
import traceback
import baseobj
import time
def main() -> None:
path = './config.json'
print('Reading config ...')
load = None
try:
load = config_loader.load_config_file(path)
except:
info = traceback.format_exc()
print(info, end='')
input('Press enter to close the program...')
return
ctx = baseobj.RunningContext()
if not load:
return
ctx.load_config(load)
ctx.run()
print('Load finish ...')
try:
while 1:
time.sleep(0.5)
if ctx.error_occured:
input('Press enter to close the program...')
break
except KeyboardInterrupt:
pass
finally:
ctx.end()
while not ctx.thread_ended:
time.sleep(0.1)
print('Program end ...')
return
if __name__ == '__main__':
main()