Hello! I am querying Refinitiv Workspace for equities based on a screen. I used to run this screen, or ones just like it, with no problem, even while using the same Python 3.11.4 that I'm using now. But now it's throwing fatal errors and not always at the same place in the loop. When I take the specific screen text that threw the error in the loop and run it on its own, it returns results with multiple companies. So the underlying screener query wouldn't seem to be a problem. So what is wrong with my below code?
import refinitiv.data as rd
rd.open_session()
import pandas as pd
indcode = [50,51,52,53,54,55,56,57,59,60,62,63]
WEurope = ["AT,BE,DK,FO,FI,FR,DE,GI,GL,GG,IS,IE,IM,IT,JE,LI,LU,MC,NL,NO,PT,SM,ES,SE,CH,GB"]
NAmerica = ["US,CA"]
CNJP = ["CN,JP"]
region = WEurope + NAmerica + CNJP
CATfields = ['TR.CommonName','TR.HeadquartersCountry','TR.HQCountryCode']
syntax = 'SCREEN(U(IN(Equity(primary,public))),\
IN(TR.TRBCEconSectorCode,{j}), IN(TR.HQCountryCode,{i}),\
TR.TRESGScore(Period=FY0)>0)'
dataCAT2 = []
df_CAT_list = []
for j in range(len(indcode)):
for i in range(len(region)):
dataCAT1 = rd.get_data(syntax.format(i=region[i],j=indcode[j]),CATfields)
dataCAT2.append(dataCAT1)
df1 = pd.concat(dataCAT2)
print(df1)
Very oddly, I can get the screen to run successfully in my global environment rather than virual (i.e., the fatal errors are only thrown when I'm in the virtual environment). This makes me wonder whether I have some package inconsistency error -- but having just installed pandas and refinitiv-data today, that wouldn't seem to be the problem.
What do you think is wrong with my code?