I am testing the validity of a RIC trying both "try.. Except" (as suggested also here) and "With Suppress" functions to continue the loop and get correct RICs into a list. Although, the code works and adds correct RICs to the list I still see the message telling the RIC is incorrect. Please see attached the screenshot and putting one of them here below as well: try_except.png
RICs = ['NDXl1721A8290.U^L21', 'NDXl1721A8275.U^L21', 'NDXd1621A6275.U^D21','NDXd1621A6300.U^D21']
valid_rics = []
for RIC in RICs:
with suppress(ek.EikonError):
a = ek.get_timeseries(RIC, fields = ['CLOSE'], start_date = '2021-01-01', end_date ='2021-04-18',interval='daily' )
valid_rics.append(RIC)
valid_rics
Is there a way to hide that? Please also note that error text appeared while using the loop and it is ignored when the code is run without a loop for a single RIC.
I would appreciate if you help to find a way of suppressing error message while using the loop.