I am using a threaded connection of kws to receive order modification callbacks. As advised in a reply to my earlier thread, after 3:15PM, I am closing the websocket by passing kws.stop(). However, I am getting hte following error:
Traceback (most recent call last): File "....", line 34, in kws.stop() File "/home/.../.local/lib/python3.8/site-packages/kiteconnect/ticker.py", line 559, in stop reactor.stop() File "/home/.../.local/lib/python3.8/site-packages/twisted/internet/base.py", line 711, in stop raise error.ReactorNotRunning("Can't stop reactor that isn't running.") twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
Why is this happening and how can I cleanly stop the websocket?
twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
I think this could happen when you don't stop while True loop, so it will keep looping and eventually stop the reactor again. Maybe break the while loop here.