AssertionError: Session must be open

Hello Refinitiv Dev,

We can not access data through refinitiv-data-library-for-python from our hosted TREP solution (ADS), as we get the following error: AssertionError: Session must be open

Can someone please check if there are any issues with our session. I have generated the app key online as per the documentation and used provided samples. Please refer to attached full logs and script used.
Thanks,

Ivan



Console Log:


Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

>>>

= RESTART: C:\Users\iriakhov\Desktop\refinitiv_python\Example.DataLibrary.Python-main\Quick Start\session.py

[2022-01-19 09:35:57,343] - [DEBUG] - [rd] - [19324] | MainThread

RD version is 1.0.0b6; Python version is 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]

[2022-01-19 09:35:58,681] - [DEBUG] - [rd] - [19324] | MainThread

Installed packages (47): anyio==3.5.0,appdirs==1.4.4,asgiref==3.2.10,certifi==2020.6.20,chardet==3.0.4,charset-normalizer==2.0.10,decorator==5.1.1,defusedxml==0.6.0,diff-match-patch==20200713,django-import-export==2.3.0,django==3.1,et-xmlfile==1.0.1,eventemitter==0.2.0,h11==0.12.0,httpcore==0.14.4,httpx==0.21.3,idna==2.10,jdcal==1.4.1,markuppy==1.14,mysql-connector-python==8.0.27,nest-asyncio==1.5.1,numpy==1.22.1,odfpy==1.4.1,openpyxl==3.0.4,pandas==1.3.5,pip==21.3.1,protobuf==3.19.3,python-configuration==0.8.2,python-dateutil==2.8.2,pytz==2020.1,pyyaml==5.3.1,refinitiv-data==1.0.0b6,requests==2.27.1,rfc3986==1.5.0,scipy==1.7.3,setuptools==47.1.0,six==1.16.0,sniffio==1.2.0,sqlparse==0.3.1,tablib==2.0.0,tenacity==8.0.1,urllib3==1.26.8,validators==0.18.2,watchdog==2.1.6,websocket-client==1.2.3,xlrd==1.2.0,xlwt==1.3.0

[2022-01-19 09:35:58,709] - [DEBUG] - [rd] - [19324] | MainThread

Read configs: ../Configuration\refinitiv-data.config.json, C:\Users\iriakhov\Desktop\refinitiv_python\Example.DataLibrary.Python-main\Quick Start\refinitiv-data.config.json, C:\Users\iriakhov\refinitiv-data.config.json, C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\refinitiv-data.config.json

[2022-01-19 09:35:59,640] - [DEBUG] - [session] - [19324] | MainThread

Creating session "sessions.platform.deployed.0" based on session.platform.Definition("platform.deployed")

[2022-01-19 09:35:59,876] - [DEBUG] - [sessions.platform.deployed.0] - [19324] | MainThread

+ Session created PlatformSession {

name=deployed,

server_mode=False,

stream_auto_reconnection=True,

signon_control=True,

authentication_token_endpoint_url=https://api.refinitiv.com/auth/oauth2/v1/token}

[2022-01-19 09:36:00,175] - [DEBUG] - [sessions.platform.deployed.0] - [19324] | MainThread

Created session connection SessionCxnType.DEPLOYED

[2022-01-19 09:36:00,243] - [DEBUG] - [sessions.platform.deployed.0] - [19324] | MainThread

[StreamingPrices id=0 universe=['CAD=']] is opening [o]

[2022-01-19 09:36:00,288] - [DEBUG] - [sessions.platform.deployed.0] - [19324] | MainThread

[StreamingPrices id=0 universe=['CAD=']] open streaming on ['CAD=']

[2022-01-19 09:36:00,306] - [DEBUG] - [sessions.platform.deployed.0] - [19324] | MainThread

[StreamingPrice id=0.0 name='CAD='] is opening [o]

[2022-01-19 09:36:00,309] - [DEBUG] - [rd.stream-factory] - [19324] | MainThread

+ Created stream=[_OMMStream id=1]

[2022-01-19 09:36:00,325] - [DEBUG] - [sessions.platform.deployed.0] - [19324] | MainThread

[StreamingPrice id=0.0 name='CAD='] Open async 1 to CAD=

Traceback (most recent call last):

File "C:\Users\iriakhov\Desktop\refinitiv_python\Example.DataLibrary.Python-main\Quick Start\session.py", line 14, in <module>

non_streaming.open(with_updates=False)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\pricing\stream.py", line 104, in open

state = self._stream.open(with_updates=with_updates)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\delivery\stream\stream_state_manager.py", line 77, in open

return self._loop.run_until_complete(self.open_async(*args, **kwargs))

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nest_asyncio.py", line 70, in run_until_complete

return f.result()

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\asyncio\futures.py", line 178, in result

raise self._exception

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\asyncio\tasks.py", line 280, in __step

result = coro.send(None)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\delivery\stream\stream_state_manager.py", line 87, in open_async

await self._do_open_async(*args, **kwargs)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\content\streaming\streamingprices.py", line 318, in _do_open_async

await stream_opens_socket.open_async(*args, with_updates=with_updates)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\delivery\stream\stream_state_manager.py", line 87, in open_async

await self._do_open_async(*args, **kwargs)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\content\streaming\streamingprice.py", line 154, in _do_open_async

await self._stream.open_async(*args, with_updates=with_updates)

File "C:\Users\iriakhov\AppData\Local\Programs\Python\Python38-32\lib\site-packages\refinitiv\data\_data\delivery\stream\stream.py", line 74, in open_async

raise AssertionError("Session must be open")

AssertionError: Session must be openrefinitiv-data.config.json.txtsession.py - Copy.txt

Tagged:

Best Answer

  • umer.nalla
    umer.nalla LSEG
    Answer ✓

    Hi @ivan.riakhovski

    An issue with RD Python Library Deployed session has been reported and confirmed by the RD Python library team.

    The fix is scheduled for early February.

    As you are aware the RD Python library is in the Beta phase.

    I will check if there is any workaround for creating a Deployed session and update you.

Answers

  • Hi @ivan.riakhovski

    The RD Python library team confirmed there is no workaround for a Deployed session with the b6 build.

    An internal b7 release is due this Friday, which should be available to customers sometime afterwards. I will update you once I know.