from __future__ import absolute_import, division, print_function

try:
    from importlib.metadata import version, PackageNotFoundError
except ImportError:
    from importlib_metadata import version, PackageNotFoundError

from .output import out

AppName = u'dosage'
try:
    __version__ = version(AppName)  # PEP 396
except PackageNotFoundError:
    # package is not installed
    pass

from __future__ import absolute_import, division, print_function

try:
    from importlib.metadata import version, PackageNotFoundError
except ImportError:
    from importlib_metadata import version, PackageNotFoundError

from .output import out

AppName = u'dosage'
try:
    __version__ = version(AppName)  # PEP 396
except PackageNotFoundError:
    # package is not installed
    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'

Return a fallback "version" if dosage is not installed
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.

  from __future__ import absolute_import, division, print_function
  
  try:
      from importlib.metadata import version, PackageNotFoundError
  except ImportError:
      from importlib_metadata import version, PackageNotFoundError
  
  from .output import out
  
  AppName = u'dosage'
  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'
  
Return a fallback "version" if dosage is not installed
## Code Before:
from __future__ import absolute_import, division, print_function

try:
    from importlib.metadata import version, PackageNotFoundError
except ImportError:
    from importlib_metadata import version, PackageNotFoundError

from .output import out

AppName = u'dosage'
try:
    __version__ = version(AppName)  # PEP 396
except PackageNotFoundError:
    # package is not installed
    pass

## Instruction:
Return a fallback "version" if dosage is not installed
## Code After:
from __future__ import absolute_import, division, print_function

try:
    from importlib.metadata import version, PackageNotFoundError
except ImportError:
    from importlib_metadata import version, PackageNotFoundError

from .output import out

AppName = u'dosage'
try:
    __version__ = version(AppName)  # PEP 396
except PackageNotFoundError:
    # package is not installed
    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'
