Skip to content

Commit

Permalink
make error message more informative again
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Sep 8, 2020
1 parent 2e53ea7 commit dd794eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion miflora/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
"""Library to read data from Mi Flora sensor"""
import sys

assert sys.version_info >= (3, 6), "Miflora requires at least Python 3.6"
# This check must be run first, so that it fails before loading the other modules.
# Otherwise we do not get a clean error message.
min_python_version = (3, 6)
if sys.version_info < min_python_version:
raise ValueError(
"miflora requires Python≥{}.{}. You're running version {}.{} from {}.".format(
*min_python_version, *sys.version_info[:2], sys.executable
)
)
from ._version import __version__ # noqa: E402, pylint: disable=wrong-import-position

__all__ = ["__version__"]

0 comments on commit dd794eb

Please sign in to comment.