nemubot/nemubot.py

28 lines
636 B
Python
Raw Normal View History

2012-04-09 02:19:39 +00:00
#!/usr/bin/python3
# coding=utf-8
import sys
import os
import imp
import traceback
2012-04-09 02:19:39 +00:00
servers = dict()
2012-04-09 02:19:39 +00:00
prompt = __import__ ("prompt")
2012-06-28 23:00:26 +00:00
if len(sys.argv) >= 2:
for arg in sys.argv[1:]:
prompt.load_file(arg, servers)
print ("Nemubot ready, my PID is %i!" % (os.getpid()))
while prompt.launch(servers):
try:
imp.reload(prompt)
except:
print ("Unable to reload the prompt due to errors. Fix them before trying to reload the prompt.")
exc_type, exc_value, exc_traceback = sys.exc_info()
sys.stdout.write (traceback.format_exception_only(exc_type, exc_value)[0])
print ("Bye")
sys.exit(0)