refinitiv.data module (python)
Hi,
I am trying to use refinitiv.data module.
I follow the steps of this page : https://github.com/Refinitiv-API-Samples/Example.DataLibrary.Python/blob/main/Examples/2-Content/2.02-Pricing/EX-2.02.03-Pricing-StreamingCache.ipynb
Here is the error I receive when running tgis code :
import os
os.environ["RD_LIB_CONFIG_PATH"] = "./"
import refinitiv.data as rd
from refinitiv.data.content import pricing
from pandas import DataFrame
rd.open_session("platform.rdp")
>>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/config/configuration.py", line 155, in __getitem__
raise KeyError(item)
KeyError: 'config-change-notifications-enabled'
What is wrong here ?
Many thanks
Best Answer
-
I assume that you modified the default configuration file (refinitiv-data.config.json) in the RD library package at Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/refinitiv/data/refinitiv-data.config.json. This file should contain the "config-change-notifications-enabled" setting.
If I remove this setting from this default configuration file, I will get the same error.
c:\python37\lib\site-packages\config\configuration_set.py in _from_configs(self, attr, *args, **kwargs)
59 for config_ in self._configs:
60 try:
---> 61 values.append(getattr(config_, attr)(*args, **kwargs))
62 except Exception as err:
63 last_err = err
c:\python37\lib\site-packages\config\configuration.py in __getitem__(self, item)
153
154 if v == {}:
--> 155 raise KeyError(item)
156 if isinstance(v, dict):
157 return Configuration(v)
KeyError: 'config-change-notifications-enabled'In summary, there are two refinitiv-data.config.json files. The default one is in the package directory which contains the default settings, such as "config-change-notifications-enabled". Another one is in the application directory which contains session settings, such as "platform.rdp". You should not modify the default one in the package directory.
1
Answers
-
Just let me add that I use python version 3.9.
The code has been ran with IDLE.
I may add some more lines in the error report :
File "/Users/Documents/PYTHON/test.py", line 22, in <module>
rd.open_session("platform.rdp")
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/refinitiv/data/_fin_coder_layer/session.py", line 44, in open_session
_config_object = get_config()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/refinitiv/data/_config_functions.py", line 14, in get_config
return _get_config()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/refinitiv/data/_configure.py", line 372, in get_config
reload()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/refinitiv/data/_configure.py", line 431, in reload
_watch_enabled = _config.get_bool(keys.watch_enabled)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/config/configuration.py", line 200, in get_bool
return as_bool(self[item])
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/config/configuration_set.py", line 110, in __getitem__
return self._from_configs("__getitem__", item)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/config/configuration_set.py", line 67, in _from_configs
raise last_err
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/config/configuration_set.py", line 61, in _from_configs
values.append(getattr(config_, attr)(*args, **kwargs))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/config/configuration.py", line 155, in __getitem__
raise KeyError(item)
KeyError: 'config-change-notifications-enabled'
0 -
Hello @CyrilC,
Can you please ensure/confirm that you have followed the Quick Start guide and all the installation steps defined in it.
0 -
Yes I did.
> pip install refinitiv.data
I modified the refinitiv-data.config.json file according to a developer instructions (so it has been tested on his computer)
And it seems the issue comes from the configuration file is not read.
As written on github, and written above, I added the Config environment path to tell where my new config file is located (next to my python script):
os.environ["RD_LIB_CONFIG_PATH"] = "./"
None worked
0 -
It looks like there might be an error in your configuration file. Can you download the sample configuration file from here. If you are using RDP then fill in the appkey, username and password section and try again.
This sessions jupyter notebook is also helpful in testing out the credentials and configuration issues. You can hardcode the appkey/username/password in the cell and see if the session creation works for you. Cell# 17 creates an RDP session.
0 -
Hi @CyrilC
Can you try the following:
- Ensure you have your config file (refinitiv-data.config.json) in your current working directory - same directory where you are running your code
- The config file should look like this (with the proper credentials defined)
- Create a small example with the following Python code
If there is success, you will see output similar to the above screenshot. Note: because I placed the config file within the current working directory, there is no need to explicitly define the environment variable - the library will automatically find the config file.
0 -
Hi,
I tried that at the beginning. It did not work.
Then, I have been told to set the os.Environ path (which I did as you can read above). It did not work either.
I just received an email explaining it is a well known issue with IDLE that seems to hide a lib dependency (configuration). See jira / browse / EAPI-4369
So, quite obvious it can't work without a possibility to configure.
Yet, this does not sort out the issue : how can I force IDLE (or anything) to import the library ?
0 -
Thank you so much Jirapongse.
It sorted it out and makes the code run !0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛