question

Upvotes
Accepted
2 5 9 13

Cannot import refinitiv-dataplatform

I cannot import refinitiv-dataplatform in python. I get the following error


import refinitiv.dataplatform as rdp

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\__init__.py", line 9, in <module>

from .core import * # noqa

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\core\__init__.py", line 4, in <module>

from .session import Session # noqa

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\core\session\__init__.py", line 12, in <module>

from .session import * # noqa

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\core\session\session.py", line 12, in <module>

import httpx

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\__init__.py", line 2, in <module>

from ._api import delete, get, head, options, patch, post, put, request, stream

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\_api.py", line 4, in <module>

from ._client import Client

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 30, in <module>

from ._transports.default import AsyncHTTPTransport, HTTPTransport

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 30, in <module>

import httpcore

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\__init__.py", line 1, in <module>

from ._api import request, stream

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\_api.py", line 5, in <module>

from ._sync.connection_pool import ConnectionPool

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\__init__.py", line 8, in <module>

from .http2 import HTTP2Connection

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\http2.py", line 8, in <module>

import h2.connection

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\h2\connection.py", line 23, in <module>

from .events import (

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\h2\events.py", line 14, in <module>

from .settings import ChangedSetting, _setting_code_from_int

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\h2\settings.py", line 91, in <module>

class Settings(collections.MutableMapping):

AttributeError: module 'collections' has no attribute 'MutableMapping' import refinitiv.dataplatform as rdp

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\__init__.py", line 9, in <module>

from .core import * # noqa

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\core\__init__.py", line 4, in <module>

from .session import Session # noqa

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\core\session\__init__.py", line 12, in <module>

from .session import * # noqa

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\refinitiv\dataplatform\core\session\session.py", line 12, in <module>

import httpx

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\__init__.py", line 2, in <module>

from ._api import delete, get, head, options, patch, post, put, request, stream

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\_api.py", line 4, in <module>

from ._client import Client

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 30, in <module>

from ._transports.default import AsyncHTTPTransport, HTTPTransport

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 30, in <module>

import httpcore

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\__init__.py", line 1, in <module>

from ._api import request, stream

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\_api.py", line 5, in <module>

from ._sync.connection_pool import ConnectionPool

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\__init__.py", line 8, in <module>

from .http2 import HTTP2Connection

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\http2.py", line 8, in <module>

import h2.connection

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\h2\connection.py", line 23, in <module>

from .events import (

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\h2\events.py", line 14, in <module>

from .settings import ChangedSetting, _setting_code_from_int

File "C:\Users\ninno\AppData\Roaming\Python\Python310\site-packages\h2\settings.py", line 91, in <module>

class Settings(collections.MutableMapping):

AttributeError: module 'collections' has no attribute 'MutableMapping'

pythonrefinitiv-dataplatform-eikon#technology
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
27.6k 67 18 14

Hello @nicola.fiore

The SymbolTypes class on Data Library for Python has been re-arrange to be a sub-class of the symbol_conversion instead as follows:

import refinitiv.data as rd
from refinitiv.data.content import symbol_conversion

symboltypes.png

symboltypes-2.png

You can find the example code of the Data Library Symbology API from the Content layer - Symbol Conversion example on the GitHub repository.


symboltypes.png (43.3 KiB)
symboltypes-2.png (48.4 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
86.2k 292 53 78

@nicola.fiore

Thank you for reaching out to us.

According to this page, you may use the old version of h2 library.

I checked h2 3.1.1 and it imported MutableMapping from collections.abc.

try:
    from collections.abc import MutableMapping
except ImportError:  # pragma: no cover
    # Python 2.7 compatibility
    from collections import MutableMapping

I suggest using the Refinitiv Data Library for Python instead.

pip install refinitiv-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.

Upvotes
2 5 9 13

Thank you. What is the corresponding "convert_symbols" function in refinitiv-data? (that is what I am using but with refinitiv-dataplatform)

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.

@nicola.fiore

Yes, it can convert symbologies.

The examples are on GitHub.

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.