question

Upvotes
Accepted
3 0 0 4

please help with the following error: [OMMSTREAMING_CHAINS_0.0] on_ws_error.

Hello,

I am getting the following socket error:

"[OMMSTREAMING_CHAINS_0.0] on_ws_error: Exception: Connection is already closed."

Please note that calling WFC.constituents works but fails on rd.getdata().

Any idea what might be the cause?

Thanks

Moti



session = rd.session.platform.Definition(

app_key = APP_KEY,

grant = rd.session.platform.GrantPassword(

username = RDP_LOGIN,

password = RDP_PASSWORD

)

).get_session()

session.open()

rd.session.set_default(session)


WFC = Chain(name="0#WFCUSDABMK=")

rd.get_data(WFC, ['RT_YIELD_1','GV4_TEXT','MATUR_DATE'])

#technology#producterror
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
17.1k 80 39 63

Hi @Moti.Konak

Can you please try this example (which is based off your failing-code.txt you attached). Because you are running from a Python environment, not within a Jupyter notebook, I structured a little differently and also ensured you closed the session to exit properly.

import refinitiv.data as rd
from refinitiv.data.discovery import Chain
import datetime
from IPython.display import display, clear_output

IPA_ENVIRONMENT = "NON-DESKTOP"
APP_KEY = "<your appkey>" 
RDP_PASSWORD = "<your password>"
RDP_LOGIN = "<your login ID>"


if __name__ == "__main__":
    #rd.get_config().set_param(
    #    param=f"logs.transports.console.enabled", value=True
    #)
    session = rd.session.platform.Definition(
        app_key = APP_KEY,
        grant = rd.session.platform.GrantPassword(
            username = RDP_LOGIN,
            password = RDP_PASSWORD
        ),
        signon_control = True
    ).get_session()
     
    session.open()
     
    rd.session.set_default(session)
     
    #session.set_log_level("DEBUG")
    
    try:
        WFC = Chain(name="0#WFCUSDABMK=")
        response = rd.get_data(WFC, ['RT_YIELD_1','GV4_TEXT','MATUR_DATE'])
        print(response)
    except Exception as e:
        print(f'Exception thrown: {e}')
        
    rd.close_session()
    print("Ready to exit...")
    exit()

After applying your credentials, your output should look something like this:

1702056935381.png


1702056935381.png (28.8 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.

Thanks for helping Nick. This is what I got:


Exception thrown: Error code -1 | EOF occurred in violation of protocol (_ssl.c:2423)

[OMMSTREAMING_CHAINS_0.0] on_ws_error: Exception: Connection is already closed.

Ready to exit...


Hi @Moti.Konak

What OS are you running on? Linux? MacOS?

The error appears to be related to something with the version of the SSL on your machine and I don’t normally see the need to update OpenSSL on Windows. Are you able to update your OpenSSL version? Another possible issue could be the version of Python libraries on your machine. You may need to upgrade the Python libs.

Hello Nick,

your inclination was correct. I found this:

https://stackoverflow.com/questions/71572810/ssl-ssleoferror-eof-occurred-in-violation-of-protocol-ssl-c1122


My python version ( 3.11.3) was causing the issue ...I guess this is a bug.....

I upgraded to 3.11.2 and the issue was fixed.

Thanks

Moti

Upvotes
4.8k 13 2 7

Hi @Moti.Konak ,


This might be a permissioning issue. Can you please run the following code in one cell and share the logs here?

rd.get_config().set_param(
    param=f"logs.transports.console.enabled", value=True
)
session = rd.session.platform.Definition(

app_key = APP_KEY,

grant = rd.session.platform.GrantPassword(

username = RDP_LOGIN,

password = RDP_PASSWORD

)

).get_session()

session.open()

rd.session.set_default(session)

session.set_log_level("DEBUG")

WFC = Chain(name="0#WFCUSDABMK=")

rd.get_data(WFC, ['RT_YIELD_1','GV4_TEXT','MATUR_DATE'])

Best regards,

Haykaz

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
3 0 0 4

Thanks Haykaz,

Please see LOG attached. Also, please note that the same code I shown was used via Codebook using the same credentials and Codebook delivered perfectly.



LOG_Chain.txt


log-chain.txt (107.6 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.

Hi @Moti.Konak ,


Thanks for sharing the logs. Do you still receive the error as I see the data is actually returned in your logs?


Best regards,

Haykaz

Upvotes
3 0 0 4

Sorry but now I am getting with no output:

RDError: Error code -1 | EOF occurred in violation of protocol (_ssl.c:2423)


One more note: on Codebook, the process takes less than 10 seconds but on Python the system spins close to a minute before I see the error.

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
17.1k 80 39 63

Hi @Moti.Konak

What error message did you receive for the run you did where you provided the log file? The log file did not show any error or warning messages.

Also, I want to confirm your specific tests. When you test in CodeBook, are you also using a platform session where you define a Password Grant?

Assuming you are, the only thing that may be different is the version of the RD Library. The version in CodeBook as of this post is 1.4.0. Which version are you using in your own environment?

Just to make sure I didn't run into any issues, I just ran a test outside of CodeBook and this is what I saw: (Note: I'm using version 1.5.0 of the rd library)

1701901600615.png


1701901600615.png (53.8 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
3 0 0 4

Thanks for following up Nick!

"What error message did you receive for the run you did where you provided the log file? "

I didn't get an error at that time. The added code by Haykaz("rd.get_config().set_param" and "session.set_log_level("DEBUG")" - shown below) improved the return and I get the expected data but with the added code I also get all the log and debugging which is clogging my process and not needed. Without the added code, the environment runs for minutes before I have to shut it down.

rd.get_config().set_param(

param=f"logs.transports.console.enabled", value=True

)

and

session.set_log_level("DEBUG")




"Which version are you using" :

The version I have is <1.5.0>


Can you please let me know what is wrong with my set up?


Thanks

Moti

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.

Hi @Moti.Konak

Thanks for confirming that is worked at some point. We just need to understand what you are doing that is causing the issues. I honestly don't know how turning logs on would cause it to succeed but we need to understand what you mean by:

"the added code I also get all the log and debugging which is clogging my process"

If the entire code segment Haykaz provided works, please include the "added code" where it fails so we can replicate.

Upvotes
3 0 0 4

Thanks Nick. I attached my codes (Code when fails and when successful) with masking the password and part of the key.

I also just run the failed code again and the error is below:


---------------------------------------------------------------------------RDError Traceback (most recent call last)c:\Users\U8015138\QPS_IPA\Access__Chains.ipynb Cell 9 line 3 33 #session.set_log_level("DEBUG") 35 WFC = Chain(name="0#WFCUSDABMK=")---> 37 rd.get_data(WFC, ['RT_YIELD_1','GV4_TEXT','MATUR_DATE'])File c:\Users\U8015138\AppData\Local\anaconda3\Lib\site-packages\refinitiv\data\_access_layer\get_data_func.py:126, in get_data(universe, fields, parameters, use_field_names_in_headers) 124 if exceptions and all(exceptions): 125 except_msg = "\n\n".join(exceptions)--> 126 raise RDError(-1, except_msg) 128 hp_and_cust_inst_data = HPAndCustInstDataContainer(stream_columns, stream_data, stream_df) 129 adc_data = ADCDataContainer(adc_raw, adc_df, fields)RDError: Error code -1 | EOF occurred in violation of protocol (_ssl.c:2423)


passing code.txt Failing code.txt


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.