From: Christian Heller Date: Thu, 19 Feb 2015 12:02:52 +0000 (+0100) Subject: Server/py: Catch shlex tokenizer ValueError exceptions in obey(). X-Git-Tag: tce~512 X-Git-Url: https://plomlompom.com/repos/edit?a=commitdiff_plain;h=40e55b700dbf1fabb7aac5f3b969d65765353418;p=plomrogue Server/py: Catch shlex tokenizer ValueError exceptions in obey(). --- diff --git a/plomrogue-server.py b/plomrogue-server.py index dfae044..7a56d55 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -53,7 +53,11 @@ def detect_atomic_leftover(path): def obey(cmd, io_db, path_recordfile): """""" print("Input: " + cmd) - tokens = shlex.split(cmd, comments=True) + try: + tokens = shlex.split(cmd, comments=True) + except ValueError as err: + print("Can't tokenize command string: " + str(err) + ".") + return if 0 == len(tokens): pass elif "PING" == tokens[0] and 1 == len(tokens):