From 9d73f6a7c0566ee8d53879ac76571118c6d871ff Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 6 Nov 2016 15:32:35 +0100 Subject: [PATCH] Fix user listing syntax Fix the error: > TypeError: string indices must be integers Caused by `print "{0}".format("\n".join(i["username"] for i in userlist))` `userlist` is a dictionary with {account :{dictionary of parameters}} so I use values() to return the dictionary of parameters. --- conf/user_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/user_list.py b/conf/user_list.py index a253599..0fd57e9 100644 --- a/conf/user_list.py +++ b/conf/user_list.py @@ -1,3 +1,3 @@ import sys, json userlist=json.loads(sys.stdin.readlines()[0])["users"] -print "{0}".format("\n".join(i["username"] for i in userlist)) +print "{0}".format("\n".join(i["username"] for i in userlist.values()))