Skip to content
Merged
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
15 changes: 1 addition & 14 deletions pymodbus/server/simulator/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@
import importlib
import json
import os
from typing import TYPE_CHECKING


try:
with contextlib.suppress(ImportError):
from aiohttp import web

AIOHTTP_MISSING = False
except ImportError:
AIOHTTP_MISSING = True
if TYPE_CHECKING: # always False at runtime
# type checkers do not understand the Raise RuntimeError in __init__()
from aiohttp import web

from pymodbus.datastore import ModbusServerContext, ModbusSimulatorContext
from pymodbus.datastore.simulator import Label
from pymodbus.logging import Log
Expand Down Expand Up @@ -124,11 +116,6 @@ def __init__(
custom_actions_module: str | None = None,
):
"""Initialize http interface."""
if AIOHTTP_MISSING:
raise RuntimeError(
"Simulator server requires aiohttp. "
'Please install with "pip install aiohttp" and try again.'
)
with open(json_file, encoding="utf-8") as file:
setup = json.load(file)

Expand Down