diff --git a/google/api_core/_python_version_support.py b/google/api_core/_python_version_support.py index 9fb92af6..2c56364b 100644 --- a/google/api_core/_python_version_support.py +++ b/google/api_core/_python_version_support.py @@ -16,12 +16,16 @@ import datetime import enum +import logging import warnings import sys import textwrap from typing import Any, List, NamedTuple, Optional, Dict, Tuple +_LOGGER = logging.getLogger(__name__) + + class PythonVersionStatus(enum.Enum): """Support status of a Python version in this client library artifact release. @@ -168,11 +172,14 @@ def _get_pypi_package_name(module_name): if module_name in module_to_distributions: # pragma: NO COVER # The value is a list of distribution names, take the first one return module_to_distributions[module_name][0] - else: - return None # Module not found in the mapping except Exception as e: - print(f"An error occurred: {e}") - return None + _LOGGER.info( + "An error occurred while determining PyPI package name for %s: %s", + module_name, + e, + ) + + return None def _get_distribution_and_import_packages(import_package: str) -> Tuple[str, Any]: