KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums PyKX PyKX could not establish an IPC connection in the Flask app Re: PyKX could not establish an IPC connection in the Flask app

  • rocuinneagain

    Member
    February 9, 2024 at 12:00 am

    Or if you only use PyKX for querying then you can use in unlicensed mode

    https://code.kx.com/pykx/2.3/user-guide/advanced/modes.html#operating-in-the-absence-of-a-kx-license

    from flask import Flask 
    import os 
    os.environ['PYKX_UNLICENSED']='true' 
    
    import pykx as kx 
    import json as j 
    app = Flask(__name__) 
    
    @app.route("/") 
    def hello_kx(): 
        #import pykx as kx 
        qcon=kx.QConnection(host='localhost', port=5000) 
        tables=qcon("tables[]").py() 
        #import json as j 
        #print(j.dumps(ports)) 
        return tables 
    
    if __name__ == '__main__': 
        app.run(host='127.0.0.1', debug=True, port=8100)