Error code -1 | Port number was not identified. eikon lib error.

sorry I can't write English.


sample code:


import eikon as ek ek.set_app_key('cxxxxx') 

eikon.eikonError.EikonError: Error code -1 | Port number was not identified. Check if Eikon Desktop or Eikon API Proxy is running.

----------------------------------

http://localhost:9000/ping?all

{"port":9000,"mode":"eikon4","pid":5352,"hasSecure":true,"startedTime":"Thu Oct 08 2020 00:46:08 GMT+0900 (대한민국 표준시)","subApps":[{"path":"/heap"},{"path":"/ping"},{"path":"/sxs","data":{"hasSecure":true,"sxsApps":{}}},{
"path":"/api"},{"path":"/sxs/v1/services/messenger"}]}


checkeikondataapi.ps1

output.txt


OS : window 10
Python version : 3.8.6 32bit

IDE : Pycharm

eikin lib version : 1.1.6.post3,
httpx version : 0.15.5




Eikon Desktop Info
eikon-desktop-info.txt


test ---
eikon lib version

1.1.2 work.

1.1.4 not work. Port number was not identified

1.1.5 not work. Port number was not identified

1.1.6 not work. Port number was not identified



thank you.

Best Answer

  • Thank you.. it's work.
    eikon lib version : 1.1.6.post3
    nest-asyncio lib version : 1.3.3


    Thank you.

Answers

  • @Hanwha-total1

    From the output.txt, the proxy is running. The problem could be in the Python libraries.

    GET: http://127.0.0.1:9000/sxs/v1 => Status Code: 200
    GET: http://127.0.0.1:9000/ping => Status Code: 200
    POST: http://127.0.0.1:9000/api/v1/data => Status Code: 200

    I can replicate the issue with Python 3.8 (32 bit) and Eikon 1.1.6.

    From my checking, it uses nest-asyncio 1.4.1. I found an issue in GitHub. Therefore, I downgraded it to 1.3.3.

    pip3.8 install nest-asyncio==1.3.3

    Then, it works fine.



  • eikon lib version 1.1.6
    nest-asyncio lib version 1.3.3

    um... it not works.


    eikon lib 1.2.2 is work.

  • @Hanwha-total1

    You can try the following command as mentioned in this thread.

    > python -c "import httpx; print(httpx.get('http://localhost:9060/api/status'))" 

    And,

    > set NO_PROXY=localhost:9000,localhost:9060> python -c "import httpx; print(httpx.get('http://localhost:9060/api/status'))"

    Then, use the following code to list the versions of python libraries.

    import pkg_resources
    installed_packages = pkg_resources.working_set
    installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
       for i in installed_packages])
    print(installed_packages_list)

    Enable logging in asyncio and httpx with the following environment variables.

    PYTHONASYNCIODEBUG=1
    HTTPX_LOG_LEVEL=trace

    Then set logging to a file.

    import logging
    logging.basicConfig(filename='example.log', level=logging.DEBUG)

    Please share the package versions and log file. You need to remove the application key in the log file.


  • attach file.

    thank you

    log.txt

  • @Hanwha-total1

    Can you test with 'eikon==1.1.6.post3'?

    1.1.6.post3 should not have this error.

    DEBUG:pyeikon:Error on checking port 9000 : AttributeError("'Request' object has no attribute 'prepare'")
  • Hi,

    Your log.txt shows that you have 'httpx==0.16.1'

    We identified that last versions (0.15 and 0.16) cause issues within connection to Eikon.
    We're investigating this. In the meantime, we recommend to downgrade to 0.14.3 version (pip install httpx==0.14.3)


  • The root cause should be found (see below last response)