From f5253c7f458a5ce4390b5e967f45bd2f0b9a1de2 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Thu, 5 Dec 2019 21:23:30 +0100 Subject: [PATCH] Return a fallback "version" if dosage is not installed Additionally, inform the user on how to fix the problem. Thanks to twb for noticing this. --- dosagelib/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dosagelib/__init__.py b/dosagelib/__init__.py index e9bc79b5c..f2f53eeff 100644 --- a/dosagelib/__init__.py +++ b/dosagelib/__init__.py @@ -27,4 +27,7 @@ try: __version__ = version(AppName) # PEP 396 except PackageNotFoundError: # package is not installed - pass + out.warn('{} is not installed, no version available.' + ' Use at least {!r} or {!r} to fix this.'.format( + AppName, 'pip install -e .', 'setup.py egg_info')) + __version__ = 'ERR.NOT.INSTALLED'