TICK Stopped with Error from Kite package (AttributeError: 'NoneType' object has no attribute )

babansfolio
Hello Team,

Today my Tick data Suddenly stopped with following Error,
This problem repeated 2-3 times in last few months,

If you know what is reason Kite is Throwing's this error and How to solve it then It will be really great help.

================================================================================================
TICK AT 2021-06-15 12:02:44.655586 FOR BANKNIFTY21JUNFUT_NFO FOR 2021-06-15 12:02:27
Traceback (most recent call last):
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/kiteconnect/ticker.py", line 613, in set_mode
six.b(json.dumps({"a": self._message_setmode, "v": [mode, instrument_tokens]}))
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/autobahn/websocket/protocol.py", line 2266, in sendMessage
self.sendFrame(opcode=opcode, payload=payload, sync=sync, rsv=4 if sendCompressed else 0)
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/autobahn/websocket/protocol.py", line 1880, in sendFrame
self.sendData(raw, sync, chopsize)
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/autobahn/websocket/protocol.py", line 1336, in sendData
self.transport.write(data)
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/twisted/protocols/tls.py", line 467, in write
self._write(bytes)
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/twisted/protocols/tls.py", line 547, in _write
self._flushSendBIO()
File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/twisted/protocols/tls.py", line 252, in _flushSendBIO
bytes = self._tlsConnection.bio_read(2 ** 15)
AttributeError: 'NoneType' object has no attribute 'bio_read'
==================================================================================================

  • rakeshr
    rakeshr edited June 2021
    AttributeError: 'NoneType' object has no attribute 'bio_read'
    If you know what is reason Kite is Throwing's this error
    This is twisted byte read error.
    Are you trying to open multiple sessions at the same time?
    Also, can you let us know, more about your setup python version and kiteconnect package version(pip show kiteconnect)
  • babansfolio
    Hello,

    I am using one API Session at a time.
    However Multiple GUI Sessions may be have open.

    Here is Kite Connect Vesion:
    ====================================================================
    Name: kiteconnect
    Version: 3.9.2
    Summary: The official Python client for the Kite Connect trading API
    Home-page: https://kite.trade
    Author: Zerodha Technology Pvt ltd. (India)
    Author-email: [email protected]
    License: MIT
    Location: /home/ubuntu/my_folder/my_env/lib/python3.5/site-packages
    Requires: service-identity, autobahn, pyOpenSSL, enum34, requests, python-dateutil, six
    Required-by:
    ==================================================================

    What could be reason of such Errors ?
    How to Prevent it?
  • rakeshr
    Can you upgrade to latest twisted package by pip install twisted --upgrade and then pip install --upgrade kiteconnect and check once, if this reoccurs?
  • babansfolio
    Hello @rakeshr : I had Upgraded to latest twisted package. But Today Problem again reproduced, here is relevant logs, Kindly suggest way forward,

    ==================================================================
    TICK AT 2021-09-03 13:47:20.727443 FOR BANKNIFTY2190938200CE_NFO FOR 2021-09-03 13:47:12
    Traceback (most recent call last):
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/kiteconnect/ticker.py", line 613, in set_mode
    six.b(json.dumps({"a": self._message_setmode, "v": [mode, instrument_tokens]}))
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/autobahn/websocket/protocol.py", line 2266, in sendMessage
    self.sendFrame(opcode=opcode, payload=payload, sync=sync, rsv=4 if sendCompressed else 0)
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/autobahn/websocket/protocol.py", line 1880, in sendFrame
    self.sendData(raw, sync, chopsize)
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/autobahn/websocket/protocol.py", line 1336, in sendData
    self.transport.write(data)
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/twisted/protocols/tls.py", line 467, in write
    self._write(bytes)
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/twisted/protocols/tls.py", line 547, in _write
    self._flushSendBIO()
    File "/home/ubuntu/my_folder/my_env/lib/python3.5/site-packages/twisted/protocols/tls.py", line 252, in _flushSendBIO
    bytes = self._tlsConnection.bio_read(2 ** 15)
    AttributeError: 'NoneType' object has no attribute 'bio_read'

    During handling of the above exception, another exception occurred:
    =====================================================================

  • rwandamc
    AttributeError means that there was an Error that had to do with an Attribute request. In general, when you write x.y, y is the purported attribute of x. NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None. That usually means that an assignment or function call up failed or returned an unexpected result.

    mylist = mylist.sort()

    The sort() method of a list sorts the list in-place, that is, mylist is modified. But the actual return value of the method is None and not the list sorted. So you've just assigned None to mylist. If you next try to do, say, mylist.append(1) Python will give you this error.

Sign In or Register to comment.