Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
12 4 3 5

AttributeError: 'EikonError' object has no attribute 'err_code'

I updated eikon in Python to version 1.1.8 and get the following error when running my code:

                while True:
                    try:
                        loop_screen, error =ek.get_data(each_request,fields)
                        break
                        
                    except ek.EikonError as err:
                        if err.err_code != 2504:
                            # request failed with other reason than 2504 error code
                            break


The error is AttributeError: 'EikonError' object has no attribute 'err_code'.

Could you please help me and tell me what to do?

Thanks

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
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
10.2k 18 6 9

@FRZH from the reference guide you can see that the EikonError object has the following parameters:

So please try:

while True:
    try:
        loop_screen, error =ek.get_data(each_request,fields)
        ##################################################################
        #I would also suggest an if error: condition here to capture bad #
        #parameters or query requests                                    #
        #A good well returned query should have empty error object       #
        ##################################################################

        if error:
            print(error)
        
        break
    
    #######################################################
    #this exception is thrown from server side
    ########################################################
    except ek.EikonError as err:
        if err.code != 2504:
            # request failed with other reason than 2504 error code
            break

I hope this can help - I have added a further error check to check data return is ok. This will detail any errors with the query itself - but does not throw an exception/EikonError object.


1608141314415.png (52.3 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
4.3k 2 4 5

Hi,

The right way to get the error code is

                    except ek.EikonError as err:
                         if err.code != 2504:
                             # request failed with other reason than 2504 error code
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.