question

Upvotes
Accepted
31 2 3 6

RDError: Error code 0 | Error happened during config file ../Configuration\refinitiv-data.config.json read

When performing the tutorial for Refinitiv Data Library for Python I did all according to the suggestions. I created a config-file with the credentials (I checked: they are correct!) and in the Quickstart tutorial I tried QS_1.0 - Sessions.ipynb.
At the rd.open_session() statement I get a lot of errors, ending with the "RDError: Error code 0 | Error happened during config file ../Configuration\refinitiv-data.config.json read"
But the config file is in the path.

I have refinitiv data version 1.3.0.

I want a platform session.
This is the file refinitiv-data.config.json:

{

"logs": {

"level": "debug",

"transports": {

"console": {

"enabled": true

},

"file": {

"enabled": false,

"name": "refinitiv-data-lib.log"

}

}

},


"sessions": {
"default": "platform.rdp",
"platform": {
"rdp": {
"app_key": "53xxxxxxxxxxxxxxxx",
"username": "xxxxxxx",
"password": "xxxxxxxx"
},
},
"desktop": {
"workspace": {
"app-key": "YOUR APP KEY GOES HERE!"
}
}
}
}

So what is the reason for this problem?

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:91, in _read_config_file(path)
     90     with open(path, "r") as f:
---> 91         data = json.load(f, cls=_JSONDecoder)
     92 except FileNotFoundError:

File ~\anaconda3\envs\refinitiv\Lib\json\__init__.py:293, in load(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    276 """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
    277 a JSON document) to a Python object.
    278 
   (...)
    291 kwarg; otherwise ``JSONDecoder`` is used.
    292 """
--> 293 return loads(fp.read(),
    294     cls=cls, object_hook=object_hook,
    295     parse_float=parse_float, parse_int=parse_int,
    296     parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)

File ~\anaconda3\envs\refinitiv\Lib\json\__init__.py:359, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    358     kw['parse_constant'] = parse_constant
--> 359 return cls(**kw).decode(s)

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:140, in _JSONDecoder.decode(self, s, _w)
    139     s = s.replace("\\", "\\\\")
--> 140 return super().decode(s, _w)

File ~\anaconda3\envs\refinitiv\Lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
    333 """Return the Python representation of ``s`` (a ``str`` instance
    334 containing a JSON document).
    335 
    336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338 end = _w(s, end).end()

File ~\anaconda3\envs\refinitiv\Lib\json\decoder.py:353, in JSONDecoder.raw_decode(self, s, idx)
    352 try:
--> 353     obj, end = self.scan_once(s, idx)
    354 except StopIteration as err:

JSONDecodeError: Expecting property name enclosed in double quotes: line 23 column 9 (char 561)

The above exception was the direct cause of the following exception:

RDError                                   Traceback (most recent call last)
Cell In[13], line 1
----> 1 rd.open_session()

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_fin_coder_layer\session.py:43, in open_session(***failed resolving arguments***)
     41 _definition = Definition
     42 _load_config = load_config
---> 43 _config_object = get_config()
     44 _set_default = set_default
     45 return _open_session(**locals())

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_config_functions.py:16, in get_config()
     10 def get_config() -> RDConfig:
     11     """
     12     Returns
     13     -------
     14     config object
     15     """
---> 16     return _get_config()

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:442, in get_config()
    432 """
    433 Gets the whole config or create it if it does not exist.
    434 
   (...)
    439 
    440 """
    441 if _config is None:
--> 442     reload()
    443 return _config

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:508, in reload()
    495 _project_config_dir = os.environ.get(_RDPLIB_ENV_DIR) or os.getcwd()
    496 _config_files_paths = [
    497     c
    498     for c in [
   (...)
    506     if c
    507 ]
--> 508 _config = _create_rdpconfig(_config_files_paths)
    509 _config.load = _load_config_from_file
    511 _observer = None

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:110, in _create_rdpconfig(files_paths)
    108 if isinstance(files_paths, str):
    109     files_paths = [files_paths]
--> 110 configs = _create_configs(files_paths)
    111 return _RDPConfig(*configs)

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:102, in _create_configs(files_paths)
    100 def _create_configs(files_paths: List[str]):
    101     config_from_dict = ext_config_mod.config_from_dict
--> 102     dicts = [_read_config_file(f) for f in files_paths] + [_config_defaults.config]
    103     configs = [config_from_dict(d) for d in dicts]
    104     return configs

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:102, in <listcomp>(.0)
    100 def _create_configs(files_paths: List[str]):
    101     config_from_dict = ext_config_mod.config_from_dict
--> 102     dicts = [_read_config_file(f) for f in files_paths] + [_config_defaults.config]
    103     configs = [config_from_dict(d) for d in dicts]
    104     return configs

File ~\anaconda3\envs\refinitiv\Lib\site-packages\refinitiv\data\_configure.py:95, in _read_config_file(path)
     93     return {}
     94 except Exception as exc:  # noqa
---> 95     raise RDError(0, f"Error happened during config file {path} read") from exc
     97 return _substitute_values(data, data)

RDError: Error code 0 | Error happened during config file ../Configuration\refinitiv-data
#technologyrefinitiv-data-platformconfigurationsession
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
Accepted
79.3k 253 52 74

@torben1

Thank you for reaching out to us.

I checked the configurations with the JSON Formatter website.

It reports this error.

1688016856141.png

Please remove a comma character at line 36.

I hope that this information is of help.


1688016856141.png (186.5 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
31 2 3 6

Thank You very much. I removed the comma and now it works.

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.