Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions connexion/apps/aiohttp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
This module defines an AioHttpApp, a Connexion application to wrap an AioHttp application.
"""

import importlib.util
import logging
import pathlib
import pkgutil
import sys

from aiohttp import web
Expand All @@ -30,11 +30,11 @@ def get_root_path(self):
if mod is not None and hasattr(mod, "__file__"):
return pathlib.Path(mod.__file__).resolve().parent

loader = pkgutil.get_loader(self.import_name)
spec = importlib.util.find_spec(self.import_name)
filepath = None

if hasattr(loader, "get_filename"):
filepath = loader.get_filename(self.import_name)
if hasattr(spec, "loader") and hasattr(spec.loader, "get_filename"):
filepath = spec.loader.get_filename(self.import_name)

if filepath is None:
raise RuntimeError(f"Invalid import name '{self.import_name}'")
Expand Down