File tree Expand file tree Collapse file tree 1 file changed +1
-14
lines changed
pymodbus/server/simulator Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change 77import importlib
88import json
99import os
10- from typing import TYPE_CHECKING
1110
1211
13- try :
12+ with contextlib . suppress ( ImportError ) :
1413 from aiohttp import web
1514
16- AIOHTTP_MISSING = False
17- except ImportError :
18- AIOHTTP_MISSING = True
19- if TYPE_CHECKING : # always False at runtime
20- # type checkers do not understand the Raise RuntimeError in __init__()
21- from aiohttp import web
22-
2315from pymodbus .datastore import ModbusServerContext , ModbusSimulatorContext
2416from pymodbus .datastore .simulator import Label
2517from pymodbus .logging import Log
@@ -124,11 +116,6 @@ def __init__(
124116 custom_actions_module : str | None = None ,
125117 ):
126118 """Initialize http interface."""
127- if AIOHTTP_MISSING :
128- raise RuntimeError (
129- "Simulator server requires aiohttp. "
130- 'Please install with "pip install aiohttp" and try again.'
131- )
132119 with open (json_file , encoding = "utf-8" ) as file :
133120 setup = json .load (file )
134121
You can’t perform that action at this time.
0 commit comments