This repository has been archived on 2020-03-29. You can view files and clone it, but cannot push or open issues or pull requests.
sampy_archive/main.py

37 lines
771 B
Python
Raw Normal View History

2018-09-24 11:37:21 +02:00
from importlib import reload
import sys
import socket
import json
from objects import glob
from objects.server import Server
from objects import client
if __name__ == "__main__":
print("> Loading config")
with open("config.json", "r") as f:
glob.config = json.load(f)
print("> Starting server")
glob.server = Server(glob.config["host"], glob.config["port"])
glob.server.start()
# Terminal loop
while True:
try:
cmd = input("> ")
if cmd == "quit" or cmd == "exit" or cmd == "stop":
exit(0)
else:
print("> Restarting...")
client.restart()
"""for module in sys.modules.values():
reload(module)
glob.server = Server(glob.config["host"], glob.config["port"])
glob.server.start()"""
except Exception as e:
print(e)