issue with refinitiv.data library under workspace

Anass
Anass Newcomer

dear developers team

i have an issue when using refinivi.data library under workspace to extract data usin get_data function

Indeed, i have the following error messages

the websocket version installed is 0.2.1.

can you help to resolve this issue as i'm working to migrate to workspace.

Regards

Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
rd.get_data("EUR=","BID")
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data_tools_lazy_loader.py", line 79, in getattr
attr = getattr(submod, name)
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data_tools_lazy_loader.py", line 78, in getattr
submod = importlib.import_module(submod_path)
File "C:\Program Files\Python312\Lib\importlib_init_.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data_access_layer\get_data_func.py", line 8, in <module>
from ._data_provider import get_data_from_stream, get_adc_data_safe
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data_access_layer_data_provider.py", line 9, in <module>
from ._mixed_streams import MixedStreams
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data_access_layer_mixed_streams.py", line 2, in <module>
from ..content._universe_stream import _UniverseStream
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\content_universe_stream.py", line 6, in <module>
from ..delivery._stream import OMMStream, StreamCache, get_service_and_details_omm
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream_init
.py", line 2, in <module>
from ._contrib_funcs import contribute, contribute_async
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream_contrib_funcs.py", line 5, in <module>
from ._stream_factory import create_offstream_contrib
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream_stream_factory.py", line 6, in <module>
from ._off_stream_contrib_connection import OffStreamContribConnection
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream_off_stream_contrib_connection.py", line 1, in <module>
from .omm_stream_connection import OMMStreamConnection
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream\omm_stream_connection.py", line 4, in <module>
from .stream_connection import StreamConnection, LOGIN_STREAM_ID
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream\stream_connection.py", line 13, in <module>
from .ws.ws_client import WebSocketClient
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream\ws\ws_client.py", line 8, in <module>
class WebSocketClient:
File "C:\Program Files\Python312\Lib\site-packages\refinitiv\data\delivery_stream\ws\ws_client.py", line 17, in WebSocketClient
def _on_ws_message(self, ws: websocket.WebSocketApp, s: str) -> None:
AttributeError: module 'websocket' has no attribute 'WebSocketApp'. Did you mean: 'WebSocket'?

Answers

  • Hello @Anass

    AttributeError: module 'websocket' has no attribute 'WebSocketApp'. Did you mean: 'WebSocket'?

    This error for the websocket typically arises when module websocket-client isn't available on the machine. Please print an output from pip list to check if you have it installed correctly.

  • Anass
    Anass Newcomer

    dear @Gurpreet

    the websocket-client is installed

    image.png
  • Gurpreet
    Gurpreet admin
    edited March 10

    Hi @Anass

    Please show the output from pip list. The existing websocket package might be getting picked up before the websocket-client. You might have to uninstall the existing websocket package, or create a new virtual environment and do a clean installation of LD Library for this to work.

    >>pip list
    Package            Version
    ------------------ -----------
    ...
    lseg-data          2.0.1
    websocket-client   1.8.0
    ...