From c478e8e25e21b3bc595038b7e03e0541b81a034e Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Wed, 18 Sep 2024 10:57:34 -0700 Subject: [PATCH] fix: when detecting momento version also catch `ModuleNotFoundError` A user reports that in some environments this code raises a `ModuleNotFoundError` as opposed to `ImportError`. We modify the try-except to also catch that error as the user reports this in a python 3.8 environment. --- src/momento/internal/_utilities/_momento_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/momento/internal/_utilities/_momento_version.py b/src/momento/internal/_utilities/_momento_version.py index 7027197d..509f1e7f 100644 --- a/src/momento/internal/_utilities/_momento_version.py +++ b/src/momento/internal/_utilities/_momento_version.py @@ -11,7 +11,7 @@ import importlib_metadata momento_version = importlib_metadata.Distribution.from_name("momento").version # type: ignore[no-untyped-call,misc] -except ImportError: +except (ImportError, ModuleNotFoundError): # For python >= 3.8 from importlib.metadata import version # type: ignore[import]