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
7 1 2 7

Eikon API - AsynclibraryNotFoundError

eikon-api-error.png

when we use Eikon API, it shows the error message. Please tell us the cause of this error, thanks.

python#technologyapiasynchronous
eikon-api-error.png (30.2 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.

@xuke

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

Upvotes
Accepted
1.3k 3 2 4

Hi @xuke ,

Thank you for reaching out to us.

I don't reproduced your issue but found where this exception is raised in httpx dependency.

We need more information on your script and how eikon lib is used so could you share your code (without any personal id, login or password) ?

Could you also provide which Python version you're using and check eikon + httpx versions with this code?

import eikon
import httpx
print(httpx.__version__)
print(eikon.__version__)

On your side, you can test following code to check if it's failing too (it should run without error):

import asyncio
from sniffio import current_async_library

async def print_lib():
    library = current_async_library()
    print("This is the current async lib: ", library)

asyncio.run(print_lib())


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.

1705643354693.png

1705643383733.png

def get_stock_commodity_code(request):
success = True     val = json.loads(request.body) code = val.get("code") date = val.get("date") return_dict = {'return_code': '200', 'return_info': 'success', 'result': False}     set_rv_app_key()  try:         rd.open_session()         df = rd.discovery.search(  view=rd.discovery.Views.SEARCH_ALL, top=1, # filter="LocalFundCode in ('006038' '012728')",                 filter="TickerSymbol eq '" + code + "' and ExpiryDateString eq '" + date + "' and DerivedCategory eq 'Future'", select="DocumentTitle,RIC"         ) except Exception as result: errorMsg = str(result) loggers.error("get commodity info exception: " + str(result)) success = False     if success: df.columns = ['instrument', 'ricCode']         result_data = df.to_json() loggers.info("get commodity info response: " + result_data) # data.to_excel("C:\\dpp\\refinitive\\test\\stock.xlsx", sheet_name='Sheet1', index=False)         return_dict['result'] = json.loads(result_data)  else: return_dict['return_code'] = 500         return_dict['return_info'] = errorMsg return_dict['result'] = {} return HttpResponse(json.dumps(return_dict), content_type="application/json")
1705643354693.png (304.2 KiB)
1705643383733.png (274.9 KiB)
Upvotes
1.3k 3 2 4

First of all, I didn't see that an error is logged before the AsynciolibraryNotFoundError !
In previous lines, you should have some information similar to :

[2024-01-18 18:16:25,071;s] - [INFO] - [log] - Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...
[2024-01-18 18:16:25,071;s] - [DEBUG] - [log] - Request to http://127.0.0.1:9060/api/status
....

Could you share it ? (take care to remove your app key).
Note that you'll find tips and tricks to check your environment (especially if Eikon API proxy is available) in Troubleshooting Userguide.


About your code, I reformat it:

def get_stock_commodity_code(request):
    success = True
    val = json.loads(request.body)
    code = val.get("code")
    date = val.get("date")
    return_dict = {"return_code": "200", "return_info": "success", "result": False}
    set_rv_app_key()
    try:
        rd.open_session()
        df = rd.discovery.search(
            view=rd.discovery.Views.SEARCH_ALL,
            top=1,
            # filter="LocalFundCode in ('006038' '012728')",
            filter="TickerSymbol eq '"
            + code
            + "' and ExpiryDateString eq '"
            + date
            + "' and DerivedCategory eq 'Future'",
            select="DocumentTitle,RIC",
        )
    except Exception as result:
        errorMsg = str(result)
        loggers.error("get commodity info exception: " + str(result))
        success = False
    if success:
        df.columns = ["instrument", "ricCode"]
        result_data = df.to_json()
        loggers.info("get commodity info response: " + result_data)
        # data.to_excel("C:\\dpp\\refinitive\\test\\stock.xlsx", sheet_name='Sheet1', index=False)
        return_dict["result"] = json.loads(result_data)
    else:
        return_dict["return_code"] = 500
        return_dict["return_info"] = errorMsg
        return_dict["result"] = {}
        return HttpResponse(json.dumps(return_dict), content_type="application/json

My feedbacks:

  1. you should manage the rd.open_session() on initializing your application, and close it (rd.close_session()) on closing your application.
  2. set_rv_app_key() is called before rd.open_session() but according to your initial log, it's the inverse:
    1705652863553.pngIs this correct or are the logs out of order?
  3. The context of calling get_stock_commodity_code() could cause the error.
    Is there any specific multi-threaded or multi-processed design?



1705652863553.png (53.9 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.

@pf

1705886841648.png

we will accept your suggestion to try again

1705886841648.png (192.9 KiB)

@pf

1705973478094.png

  1. you should manage the rd.open_session() on initializing your application, and close it (rd.close_session()) on closing your application.

Is this question related to this advise?


1705973478094.png (51.6 KiB)

1705656738511.png

we will try to run program with this advises

  1. you should manage the rd.open_session() on initializing your application, and close it (rd.close_session()) on closing your application.
  2. set_rv_app_key() is called before rd.open_session() but according to your initial log, it's the inverse:
    1705652863553.pngIs this correct or are the logs out of order?
1705656738511.png (133.1 KiB)

1705656983849.png


we will try to run program with this advises

  1.    
                         
    1. you should manage the rd.open_session() on initializing your application, and close it (rd.close_session()) on closing your application.
  2.    
                         
    1. set_rv_app_key() is called before rd.open_session() but according to your initial log, it's the inverse:
    2. 1705652863553.pngIs this correct or are the logs out of order?
1705656983849.png (194.6 KiB)
Upvotes
1.3k 3 2 4

Hi,

I noticed that during initialization, the initial steps are failing.

Could you verify that your Eikon product is allowed for Python usage. In Help>About Refinitiv Eikon, APPS tab, you should find REFINITIVHOLDINGS.EIKON.DATAAPIPROXY app:

1705996038016.png

Then test http://localhost:9060/api/status to verify if the Data API Proxy was started successfully:

1705996136533.png



1705996038016.png (51.3 KiB)
1705996136533.png (14.0 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.

1705996674819.png

1705996699180.png

this is right

1705996674819.png (104.8 KiB)
1705996699180.png (11.9 KiB)
Upvotes
1.3k 3 2 4

Your versions arn't recent:

  • Eikon 3.3.11
  • DATA API PROXY 1.9.0.0

It could explain why it's failing.
Did it work before ?

You should contact your Account Manager to upgrade to Eikon 3.6.6 (it contains API Proxy 1.10.0.0).


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.

@pf Thanks for your advice. We connect the support hotline, but failed to upgrade from Eikon 3.3.11 (Data API Proxy 1.9.0.0) to Eikon 3.6.6 (Data API Proxy 1.10.0.0).
Below information for your reference.


Steps Done:
Eikon had been uninstalled and reinstalled by PC Admin.

1. Ended Excel, Word, PPT and Eikon processes.
2. Uninstalled the obsolete version of Eikon from Windows Control Panel > Programs and Features.
3. Downloaded the latest version Eikon 4.0.64, installed Eikon 4.0.64 and VBA71 one by one with PC Admin.
4. Logged in Eikon 4.0.64 successfully.

Checked the Data API Proxy version: it was showing Eikon 3.3.11 (Data API Proxy 1.9.0.0), failed to upgrade.

5. Referred to below link, tried the steps, the version still at Eikon 3.3.11 (Data API Proxy 1.9.0.0).

https://developers.lseg.com/en/api-catalog/eikon/eikon-data-api/tutorials#how-to-update-your-eikon-data-api

Hi @xuke ,

Have you tried restart the machine and check the data API proxy version again? Some process of the proxy might not ended properly previously.

xuke avatar image xuke raksina.samasiri

Hi Raksina,

Yes, already restart the machine. but the data API proxy version is still

{"statusCode":"ST_PROXY_READY","version":"3.3.11-eikon4"}
Show more comments

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.