UnboundLocalError when starting simulator server from a Thread #2408
Unanswered
elarandjelovic
asked this question in
Help
Replies: 2 comments 1 reply
-
Please have a look at our test suite, f.x. the sub_examples section, there we have a lot of tests with a sync client that connect to a async server in the same context. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Our current version is 3.7.4, so how do you test with a version higher than 3.9.0 If you mean python version, then we currently test with 3.9 - 3.13, we no longer support 3.8, but it probably works. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a question relating to the dependency on aiohttp, which has come about as a result of trying to use the Pymodbus simulator in Pytest. I have a specific need to use the synchronous client, which unfortunately makes life difficult in Pytest because it means that my test is not in an asyncio context but the fixture which starts the simulation server is. To get around this I have created a fixture which starts up the simulation server in a separate Thread. This should work, but I came across an unexpected error in aiohttp triggered by the following code at the end of the ModbusSimulatorServer constructor:
aiohttp throws an UnboundLocal error because it fails to find in the frame stack when the server has been started in a new Thread.
If I downgrade aiohttp to a version pre 3.9.0 this doesn't happen and my test works fine.
Has anybody else come across this, and is there a way to avoid the problem without having to downgrade aiohttp? Many thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions