KX Community

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

Home Forums PyKX PyKx Console not showing from IPC Port

  • PyKx Console not showing from IPC Port

    Posted by cleung on May 25, 2023 at 12:00 am

    Hi there, 

    I’m pretty new to using PyKX, and when migrating our code over from KDB to PyKX, we are running into issues with logging. We are using QConnection/IPC to grab a port in an existing environment, and query functions now via python. However, what’s missing is that when these functions get executed, the logs (stdout) are not being recorded in the python console, most likely because the logs are not being translated from the ports consolt to the Python console. Is there any workaround this? 

     

    Thanks for your help!

    Charles

    cleung replied 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • cleung

    Member
    May 26, 2023 at 12:00 am

    Yeah that sounds about right. The original function has STDOUT so the logs are visible to the Q Console only, but not the python consonsole where PYKX is running. Since we use many many functions with this logging feature already, is there a way we can have logs from Q server relayed back to the PyKX console? Doesn’t have to be STDOUT but maybe through another process? Thanks

  • rocuinneagain

    Member
    May 26, 2023 at 12:00 am

    Is this what you mean;

     

    You have a q server with a function which logs some information:

     

    q)p 5000 p)func:{-1 “Logging some info on params:”,.Q.s1 (x;y);x+y}

     

    You call that function from PyKX:

     

    >>> conn = pykx.QConnection(‘127.0.0.1’, 5000) >>> conn(“func”,4,5) pykx.LongAtom(pykx.q(‘9’))

     

    In the q console the log is printed:

     

    q) Logging some info on params:4 5

     

    But you would like this message to be logged in your PyKX console?

    The standard functionality will not print those messages logged to SDTOUT back to your python process.

Log in to reply.