From eb0a533dc792bd91e795554a4965e163a2872a84 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Sun, 12 Apr 2020 02:37:38 +0800 Subject: [PATCH 1/2] Polish UnicodeDecodeError --- src/azure-cli-core/azure/cli/core/_profile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index f1d3b1ba880..4bfa47d1914 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -1202,6 +1202,11 @@ def _get_authorization_code_worker(authority_url, resource, results): break except socket.error as ex: logger.warning("Port '%s' is taken with error '%s'. Trying with the next one", port, ex) + except UnicodeDecodeError: + logger.warning("Please make sure there is no international characters in " + "the computer name or 127.0.0.1 entries in C:\Windows\System32\drivers\etc\hosts file. " + "For more details, please see https://github.com/Azure/azure-cli/issues/12957") + break if reply_url is None: logger.warning("Error: can't reserve a port for authentication reply url") From 4ed949e1c7ff329e4f78a848189ecebe43df0221 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Sun, 12 Apr 2020 03:02:27 +0800 Subject: [PATCH 2/2] Refine --- src/azure-cli-core/azure/cli/core/_profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index 4bfa47d1914..38877ec69df 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -1203,8 +1203,8 @@ def _get_authorization_code_worker(authority_url, resource, results): except socket.error as ex: logger.warning("Port '%s' is taken with error '%s'. Trying with the next one", port, ex) except UnicodeDecodeError: - logger.warning("Please make sure there is no international characters in " - "the computer name or 127.0.0.1 entries in C:\Windows\System32\drivers\etc\hosts file. " + logger.warning("Please make sure there is no international (Unicode) character in the computer name " + r"or C:\Windows\System32\drivers\etc\hosts file's 127.0.0.1 entries. " "For more details, please see https://github.com/Azure/azure-cli/issues/12957") break