2022.02.13 01:36 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:\Users\srv\.conda\envs\qenv\q\extend.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};
2022.02.13 02:35 PM
Hi Ori,
Interesting to see if anyone else in the Community has tried using this library who may be able to assist 🤞
Just in case anyone else is interesting in looking at this issue, can I check you are referring to these projects?
Thanks for sharing with the Community.
Kind regards,
David
2022.02.14 12:24 AM
Thanks David
Do you know how to debug such cases? I try to display contents
of the python library and understand what is the problem there,
I can't get it working the output is not clear and I can't understand
whet is the problem?
Ori
2022.02.15 02:31 AM
The error is that a variable "cxt" is not being found.
https://code.kx.com/q/basics/errors/#runtime-errors
General debugging tips included on: https://code.kx.com/q/basics/debug/
As this is a third party project you will get better support by raising an issue with the developer directly:
The developer does not document the supported embedPy versions which would be important to know.
One difference I see is you are calling
pc:.cbpro.PublicClient[]
But the developer passes a string - this could be your issue
cli: .cli.priv.addFuncs .cbpro.PublicClient[url];
2022.02.15 02:44 AM
Thanks Rian
I am already in contact with Michael on this issue.
He is busy with other things so I try to resolve problem myself.
Will try to insert the url, will you be able to help me debug this problem?
I'm stack with it since last week....
Ori
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.