The following error pops up when I try to unsubscribe to all subscribed tokens in threaded=True mode.
Traceback (most recent call last):
File "D:\Anaconda\envs\pyv3916v\lib\site-packages\kiteconnect\ticker.py", line 601, in unsubscribe for token in instrument_tokens:
RuntimeError: dictionary changed size during iteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Meenakshi Sundaram\AppData\Local\Temp\ipykernel_34460\900885960.py", line 1, in adapter.kws.unsubscribe(adapter.kws.subscribed_tokens)
File "D:\Anaconda\envs\pyv3916v\lib\site-packages\kiteconnect\ticker.py", line 609, in unsubscribe self._close(reason="Error while unsubscribe: {}".format(str(e)))
File "D:\Anaconda\envs\pyv3916v\lib\site-packages\kiteconnect\ticker.py", line 553, in _close self.ws.sendClose(code, reason)
File "D:\Anaconda\envs\pyv3916v\lib\site-packages\autobahn\websocket\protocol.py", line 1991, in sendClose raise Exception("close reason without close code")
I think this was probably happening because I did not subscribe to any instrument when i called kws.connect(), and then I was subscribing to all the instruments I wanted. The program worked as expected, and logged all the ticks despite the error.
Now I am having a new problem, which I have posted in this thread
Now I am having a new problem, which I have posted in this thread