From 3990b182e8148ec1b3eb1517ee79986b8c88320a Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 14 Sep 2021 09:50:45 -0500 Subject: [PATCH] fixed version check to work even without internet --- gradio/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gradio/utils.py b/gradio/utils.py index 65c2988cc9..8210fa4894 100644 --- a/gradio/utils.py +++ b/gradio/utils.py @@ -3,6 +3,9 @@ import json.decoder import requests import pkg_resources from distutils.version import StrictVersion +from socket import gaierror +from urllib3.exceptions import MaxRetryError + analytics_url = 'https://api.gradio.app/' PKG_VERSION_URL = "https://api.gradio.app/pkg-version" @@ -17,15 +20,14 @@ def version_check(): "is available, please upgrade.".format( current_pkg_version, latest_pkg_version)) print('--------') - except pkg_resources.DistributionNotFound: raise RuntimeError("gradio is not setup or installed properly. Unable to get version info.") except json.decoder.JSONDecodeError: - raise RuntimeWarning("Unable to parse version details from package URL.") + print("Warning: unable to parse version details from package URL.") except KeyError: - raise RuntimeWarning("Package URL does not contain version info.") - except ConnectionError: - raise RuntimeWarning("Unable to connect with package URL to collect version info.") + print("Warning: Package URL does not contain version info.") + except: + print("Warning: unable to connect with package URL to collect version info.") def error_analytics(type):