From: Christian Heller Date: Sun, 22 Feb 2015 04:56:49 +0000 (+0100) Subject: Server/py: Add line number handling. X-Git-Tag: tce~509 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D/balance2?a=commitdiff_plain;h=168d6669e5d524b6c41781c6ed03bc181919957a;p=plomrogue Server/py: Add line number handling. --- diff --git a/plomrogue-server.py b/plomrogue-server.py index 44c86a9..3bcb166 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: @@ -82,7 +82,6 @@ def record(cmd, path_recordfile): file.close() - io_db = {} try: parser = argparse.ArgumentParser() @@ -107,10 +106,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: