Importer issues
@@ -58,12 +58,15 @@ class ServiceImporter(object):
try:
spec.loader.exec_module(service_import)
except ImportError as e:
+ if service_import and str(e) == "No module named '{}'".format(service_import.__name__):
+ logging.getLogger('import').warning('Invalid service package/parent name, may conflict with Python internals: "{}" - change parent folder name'.format(file_path.rsplit('/', 2)[1]))
+ raise ServicePackageError from e
if str(e) == 'attempted relative import with no known parent package':
logging.getLogger('import').warning('Invalid service package/parent name, may conflict with Python internals: "{}" - change parent folder name'.format(file_path.rsplit('/', 2)[1]))
raise ServicePackageError from e
raise e
except SystemError as e:
- if re.match(r"^Parent module '.*' not loaded, cannot perform relative import$", str(e)):
+ if service_import and str(e) == "Parent module '{}' not loaded, cannot perform relative import".format(service_import.__name__):
logging.getLogger('import').warning('Invalid service package/parent name, may conflict with Python internals: "{}" - change parent folder name'.format(file_path.rsplit('/', 2)[1]))
raise ServicePackageError from e
raise e
