Skip to content

Commit

Permalink
fix: changed to exception
Browse files Browse the repository at this point in the history
  • Loading branch information
tdejager committed Mar 21, 2024
1 parent 980b2e3 commit b11cd64
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import importlib.metadata
import warnings

try:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError as e:
warnings.warn(f"Could not determine version of {__name__}", stacklevel=1)
warnings.warn(str(e), stacklevel=1)
except importlib.metadata.PackageNotFoundError:
__version__ = "unknown"
raise Exception(f"Could not determine version of {__name__}")

0 comments on commit b11cd64

Please sign in to comment.