KX Community

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

Home Forums KX Solutions embedPy inside q (kdb+) process fails to import a module

  • embedPy inside q (kdb+) process fails to import a module

    Posted by kovacsi on February 13, 2022 at 12:00 am

    Hi community

    I must learn how to use python modules inside q kdb+ process.

    at the process of learning :

    1.  using windows 10 x64 q , kdb+ , anaconda virtual environment

    on python 3.8.10, and KX Developer IDE.

    2. learned how to use embedPy and successfully loaded some

    python modules like ‘os’ in to q using reflections.

     

    now

    I try to use qoinbase-q to learn integrating embedPy with web-sockets
    on q kdb+ database.

    this code use an other project to extend q language using python modules
    extend .it fail on a point attempting to get functions of coin-pro python
    library.

    q)pc:.cbpro.PublicClient[]
    'cxt
    [4] C:Userssrv.condaenvsqenvqextend.q:181: .py.reflection.priv.context@:{.py.reflection.priv[y;`cxt][x;z]}

    can you help me fined how to debug it and resolve the problem?

    thanks
    Ori

     

    the function is:

    .py.reflection.priv.context:{[obj; atr; arg] 
    init: atr[`functions][`$"__init__"]; 
    params: init[`parameters]; 
    required: params[::;`required]; 
    if[(arg~(::)) and (any required);
     '"Missing required parameters: ",", " sv string where required];
     blk: .ut.blankNS; 
    arg: .py.reflection.priv.args[arg];
    ins: $[1<count arg;.;@][obj;arg];
     atr[`vars]: .py.vars[ins];
     atr: @[atr;`functions;{x _ `$"__init__"}];
     cxt: blk,(,/)value .ut.eachKV[`doc _ atr;{.py.reflection.priv[y;`cxt][x;z]}[ins]];
     cxt
    };
    kovacsi replied 1 month, 1 week ago 3 Members · 4 Replies
  • 4 Replies

Log in to reply.