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

Upvote
Accepted
35 4 3 5

Error Code 2504- Occurs at random times in code, how is this error caused and how is it solved?

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apierror
error-gateway.png (21.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.

1 Answer

· Write an Answer
Upvotes
Accepted
4.3k 2 4 5

Hi,

As you mention, this error could occur randomly.

A way to protect your code is to catch the exception then retry your request after a delay.

Ex:

from threading import Event
timer = Event()
...
while True:
    try:
        ts = ek.get_timeseries(...)
        break
    except ek.EikonError as err:
        if err.err_code != 2504:
            # request failed with other reason than 2504 error code
            break
        # let's retry after a delay
        timer.wait(1)

(timer.wait() is better than time.sleep())

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,

I'm having the same issue. I'm retrying a few times, and still seeing either "Error code 2504 | UDF Core request failed. Gateway Time-out" or "Error code 500 | Backend error. 500 Internal Server Error". Would you know the reason why this occurs?

Also, could you please elaborate on why timer.wait() is preferable? Would switching from time.sleep() to timer.wait() help alleviate these issues?

Thank you,

Shashank

Hi, Can you please explain why this is better? (timer.wait() is better than time.sleep())

I am not currently multitreading but having similar issue.

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.