From 4c1ed337707b8f441c9e31d691127dce1b818a48 Mon Sep 17 00:00:00 2001 From: nnshah1 Date: Fri, 5 Jan 2024 16:44:37 -0800 Subject: [PATCH] update to guard in case package not installed --- src/python/library/tritonclient/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/python/library/tritonclient/__init__.py b/src/python/library/tritonclient/__init__.py index 674b238f1..a19914f30 100755 --- a/src/python/library/tritonclient/__init__.py +++ b/src/python/library/tritonclient/__init__.py @@ -26,8 +26,13 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from importlib.metadata import version +from importlib.metadata import PackageNotFoundError, version -__version__ = version("tritonclient") +__version__ = "UNKNOWN" + +try: + __version__ = version("tritonclient") +except PackageNotFoundError: + pass del version