I changed the tokens but getting now following error -
calling KWS.connect finished kws connect process Exception in thread Thread-15: Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:\ProgramData\Anaconda3\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1242, in run self.startRunning(installSignalHandlers=installSignalHandlers) File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1222, in startRunning ReactorBase.startRunning(self) File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 730, in startRunning raise error.ReactorNotRestartable() twisted.internet.error.ReactorNotRestartable
Above was on windows (spider). On my Linux box , it does nothing... no ticks printed and no error. Just prints msg before and after the connect() call.
File "", line 1, in runfile('D:/workspace_pyCharm/Test_Zerodha.py', wdir='D:/workspace_pyCharm')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/workspace_pyCharm/Test_Zerodha.py", line 67, in kws.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\kiteconnect-3.7.4-py3.6.egg\kiteconnect\ticker.py", line 532, in connect reactor.run(**opts)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1242, in run self.startRunning(installSignalHandlers=installSignalHandlers)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1222, in startRunning ReactorBase.startRunning(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 730, in startRunning raise error.ReactorNotRestartable()
@UE6253 I copy pasted your above code in my env, it's returning all subscribed ticks. Make sure, you are not calling, on_close method anywhere else. It can also your be local environement issue.Can you try above modified code in Linux and check it, again.
Rakesh - I'm facing same problem, only different is that i'm calling the callback function program multiple time from outside. First time it works but next time it throws error - "c:\.....\programs\python\python36\lib\site-packages\twisted\internet\base.py", line 765, in startRunning raise error.ReactorNotRestartable() I'm doing something wrong, please guide if possible.
Are you trying to run on_tick thread multiple time?
Can you paste your code here.
tokens = ['NSE:NCC', 'NSE:INFY']
You need to use
instrument_token
instead of tradingsymbol, check it here.calling KWS.connect
finished kws connect process
Exception in thread Thread-15:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\ProgramData\Anaconda3\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1242, in run
self.startRunning(installSignalHandlers=installSignalHandlers)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1222, in startRunning
ReactorBase.startRunning(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 730, in startRunning
raise error.ReactorNotRestartable()
twisted.internet.error.ReactorNotRestartable
Just prints msg before and after the connect() call.
You need to remove
threaded=True
fromkws.connect( threaded=True)
, as i don't see you are implementing any external thread.File "", line 1, in
runfile('D:/workspace_pyCharm/Test_Zerodha.py', wdir='D:/workspace_pyCharm')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/workspace_pyCharm/Test_Zerodha.py", line 67, in
kws.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\kiteconnect-3.7.4-py3.6.egg\kiteconnect\ticker.py", line 532, in connect
reactor.run(**opts)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1242, in run
self.startRunning(installSignalHandlers=installSignalHandlers)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 1222, in startRunning
ReactorBase.startRunning(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py", line 730, in startRunning
raise error.ReactorNotRestartable()
ReactorNotRestartable
I copy pasted your above code in my env, it's returning all subscribed ticks. Make sure, you are not calling, on_close method anywhere else.
It can also your be local environement issue.Can you try above modified code in Linux and check it, again.
raise error.ReactorNotRestartable()
I'm doing something wrong, please guide if possible.
I am also getting this error. I do not have threaded=True or other aforementioned points.