New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
1 0 0 0

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

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
pythonrefinitiv-realtime#technologyrefinitiv-data-librariesstreaming-data
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@anirudh.gottiparthy

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

Upvotes
Accepted
87.8k 294 53 79

@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"
      }
    }
  }, 

1721967943352.png (2.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 0
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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.