From 69e9ebafe43cc14007178d82a015e24b1ac6f065 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Wed, 21 Oct 2020 10:43:13 +0200 Subject: [PATCH] Add workaround for python 2 % vs + presedence issue The prompt showed '%s' instead of the list of engines without this change. --- client/populate.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/populate.py b/client/populate.py index 756297b1a..ee56bc850 100644 --- a/client/populate.py +++ b/client/populate.py @@ -108,10 +108,12 @@ def verifyLocation(place): "google": "GOOGLE_SPEECH" } - response = raw_input("\nIf you would like to choose a specific STT " + - "engine, please specify which.\nAvailable " + - "implementations: %s. (Press Enter to default " + - "to PocketSphinx): " % stt_engines.keys()) + # Join text in msg to work around + and % issue with Python 2 + msg = "\nIf you would like to choose a specific STT " + \ + "engine, please specify which.\nAvailable " + \ + "implementations: %s. (Press Enter to default " + \ + "to PocketSphinx): " + response = raw_input(msg % stt_engines.keys()) if (response in stt_engines): profile["stt_engine"] = response api_key_name = stt_engines[response]