From ea8254c68eef7ec73968dcaf3800d72dbcb9a8d5 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Sun, 8 Dec 2013 00:56:37 +0100 Subject: [PATCH] Respect that playerInput can be none --- seopardy.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/seopardy.py b/seopardy.py index 07dd996..b870ceb 100755 --- a/seopardy.py +++ b/seopardy.py @@ -73,19 +73,20 @@ if __name__ == '__main__': # create and start input threads print(config["playerInput"]) inputs = [] - for playerInput in config["playerInput"]: - args = playerInput.get("Args", []) - if args is None: - args = [] + if config["playerInput"] is not None: + for playerInput in config["playerInput"]: + args = playerInput.get("Args", []) + if args is None: + args = [] - try: - inp = get_input(playerInput["Type"], args, app) - inputs.append(inp) - except InputException as e: - print("Error: %s" % e, file=sys.stderr) - sys.exit(1) + try: + inp = get_input(playerInput["Type"], args, app) + inputs.append(inp) + except InputException as e: + print("Error: %s" % e, file=sys.stderr) + sys.exit(1) - inputs[-1].start() + inputs[-1].start() # create board board = SeopardyGame(questions, gamestate)