def get_module_file_attribute(package):
 try:
  loader = pkgutil.find_loader(package)
  attr = loader.get_filename(package)
 except (AttributeError, ImportError):
  __file__statement = '\n            import %s as p\n            print(p.__file__)\n        '
  attr = exec_statement((__file__statement % package))
  if (not attr.strip()):
   raise ImportError
 return attr

def get_module_file_attribute ( package ) : try : loader = pkgutil . find_loader ( package ) attr = loader . get_filename ( package ) except ( AttributeError , ImportError ) : __file__statement = '\n            import %s as p\n            print(p.__file__)\n        ' attr = exec_statement ( ( __file__statement % package ) ) if ( not attr . strip ( ) ) : raise ImportError return attr
get the absolute path of the module with the passed name .