X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomrogue-server.py;h=ceeb237d944ca378364819f1f6a5afec580d27e2;hb=8731bb2acd39cd33af45278c75d8b8ff9ca58306;hp=44c86a949f85a7e1ca614dd26d7dee1f4c0fe8e4;hpb=5fba7c516c6568a5e2c30ccf7114f7529619df01;p=plomrogue diff --git a/plomrogue-server.py b/plomrogue-server.py index 44c86a9..ceeb237 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -53,9 +53,9 @@ def detect_atomic_leftover(path): raise SystemExit(msg) -def obey(cmd, io_db): #, path_recordfile): +def obey(cmd, io_db, prefix): """""" - print("Input: " + cmd) + print("input " + prefix + ": " + cmd) try: tokens = shlex.split(cmd, comments=True) except ValueError as err: @@ -77,12 +77,12 @@ def obey(cmd, io_db): #, path_recordfile): def record(cmd, path_recordfile): """Append cmd string plus newline to file at path_recordfile.""" + # Doesn't yet replace old record() fully. file = open(path_recordfile, "a") file.write(cmd + "\n") file.close() - io_db = {} try: parser = argparse.ArgumentParser() @@ -107,10 +107,12 @@ try: msg = "No world config file from which to start a new world." raise SystemExit(msg) file = open(io_db["path_worldconf"]) + line_n = 1 for line in file.readlines(): - obey(line.rstrip(), io_db) + obey(line.rstrip(), io_db, "worldconfig file line " + str(line_n)) + line_n = line_n + 1 file.close() - obey("MAKE_WORLD " + str(int(time.time())), io_db) + obey("MAKE_WORLD " + str(int(time.time())), io_db, "in file") except SystemExit as exit: print("ABORTING: " + exit.args[0]) except: