#!/usr/bin/env python
import argparse
import sys
import importlib

_parser = argparse.ArgumentParser(description='Print location of Python module.')
_parser.add_argument(
    'module', nargs='+', help='Python module(s) to print the location of.'
)


def _main():
    args = _parser.parse_args()
    for module_name in args.module:
        try:
            module = importlib.import_module(module_name)
            print(module.__file__)
        except ImportError as error:
            print(f'{type(error).__name__}: {str(error)}', file=sys.stderr)


if __name__ == '__main__':
    _main()
