Python | Refinitiv Data | stream.recorder | TypeError: 'NoneType' object does not support item assig

I am intermittently seeing the below error. What could be a possible reason for this issue to occur?

This error pops up when looping through an array of streams (each stream contains a list of RICs to perform:

stream.recorder.record(frequency='tick')

Error:

Exception in thread Msg-Proc-ThreadOMMSTREAMING_PRICING_0.0:
...
...
...
File "*\refinitiv\data\_access_layer\_stream_update_handler.py", line 57, in _on_update_handler
    message["Timestamp"] = datetime.now()
    ~~~~~~~^^^^^^^^^^^^^
TypeError: 'NoneType' object does not support item assignment

Best Answer

  • Jirapongse
    Answer ✓

    @anirudh.gottiparthy

    Thank you for sharing the code.

    However, I ran it several times and still was unable to replicate this issue. I am using RD 1.6.1.

    1721967943352.png

    Please check the version of RD library that you are using.

    Can you share the debug log when the problem occurred?

    You can use the following configurations to enable the file debug log.

      "logs": {
        "level": "debug",
        "transports": {
          "console": {
            "enabled": false
          },
          "file": {
            "enabled": true,
            "name": "refinitiv-data-lib.log"
    }

        }
      },

Answers

  • @anirudh.gottiparthy

    Could you share the runnable code that can be used to replicate this issue? Therefore, I can test it on my machine.

  • import refinitiv.data as rd
    import logging
    import time

    session = rd.open_session('platform.rdp')
    session.set_log_level(logging.DEBUG)
    stream_array = []
    stream_list = [['LCOV4', 'BOZ24'],
    ['GCZ24', 'HGU24'],
    ['LGOU4', 'LHV24']]

    for stream in stream_list:
    stream_array.append(rd.open_pricing_stream(universe=stream, fields=['TRDVOL_1', 'TRDPRC_1','SALTIM']))

    for stream in stream_array:
    stream.recorder.record(frequency='tick')

    time.sleep(60)

    for stream in stream_array:
    stream.recorder.stop()
    df = stream.recorder.get_history()
    stream.recorder.delete()

    This is an example snippet derived from my code. The error does not always occur but when it does, it pops up after all the streams have started recording. My actual stream_list contains 6 streams with about 8 markets on each stream.