From 6cf3203096cc775e85a4a95e519d1ce7801407f2 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Thu, 11 Oct 2018 10:28:26 +0200 Subject: [PATCH 1/2] Retry webbrowser.open() after a TypeError This is a workaround for [This bug](https://bugs.python.org/msg322439) in Python 3.7 Fixes #7033 --- src/azure-cli-core/azure/cli/core/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/util.py b/src/azure-cli-core/azure/cli/core/util.py index b3317d6528e..085aedacae9 100644 --- a/src/azure-cli-core/azure/cli/core/util.py +++ b/src/azure-cli-core/azure/cli/core/util.py @@ -288,7 +288,10 @@ def open_page_in_browser(url): # understand the "open location" message" # b. Python 2.x can't sniff out the default browser return subprocess.Popen(['open', url]) - return webbrowser.open(url, new=2) # 2 means: open in a new tab, if possible + try: + return webbrowser.open(url, new=2) # 2 means: open in a new tab, if possible + except TypeError as err: # See https://bugs.python.org/msg322439 + return webbrowser.open(url, new=2) def _get_platform_info(): From e07c8e79f481b6a759fb8022daaabba112066cbb Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Thu, 11 Oct 2018 14:36:26 +0200 Subject: [PATCH 2/2] Remove unused variable --- src/azure-cli-core/azure/cli/core/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/util.py b/src/azure-cli-core/azure/cli/core/util.py index 085aedacae9..020bc0e6972 100644 --- a/src/azure-cli-core/azure/cli/core/util.py +++ b/src/azure-cli-core/azure/cli/core/util.py @@ -290,7 +290,7 @@ def open_page_in_browser(url): return subprocess.Popen(['open', url]) try: return webbrowser.open(url, new=2) # 2 means: open in a new tab, if possible - except TypeError as err: # See https://bugs.python.org/msg322439 + except TypeError: # See https://bugs.python.org/msg322439 return webbrowser.open(url, new=2)