diff --git a/src/pybump.py b/src/pybump.py index 7b5e509..5c65c75 100644 --- a/src/pybump.py +++ b/src/pybump.py @@ -4,6 +4,7 @@ from sys import stderr from ruamel.yaml import YAML, YAMLError + try: from .pybump_version import PybumpVersion except ImportError: @@ -57,9 +58,12 @@ def get_self_version(dist_name): :param dist_name: string :return: version as string """ - # https://docs.python.org/3/library/importlib.metadata.html#distribution-versions - from importlib.metadata import version - return version(dist_name) + try: + # https://docs.python.org/3/library/importlib.metadata.html#distribution-versions + from importlib.metadata import version + return version(dist_name) + except ModuleNotFoundError: + return 'version not found' def write_version_to_file(file_path, file_content, version, app_version):