Skip to content

Commit

Permalink
deal with pint errors at import
Browse files Browse the repository at this point in the history
  • Loading branch information
getzze committed Oct 18, 2024
1 parent d7135a4 commit e9f06b8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions knowit/units.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import logging
import typing

logger = logging.getLogger(__name__)


class NullRegistry:
"""A NullRegistry that masquerades as a pint.UnitRegistry."""
Expand Down Expand Up @@ -30,6 +33,8 @@ def _build_unit_registry():
return registry
except ModuleNotFoundError:
pass
except Exception:
logger.exception("Cannot import the pint package")

return NullRegistry()

Expand Down

0 comments on commit e9f06b8

Please sign in to comment.