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

Options

Best Answer

  • pf
    pf LSEG
    Answer ✓

    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())

Answers

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.