Debugging embedPy library extension called extendPy

https://learninghub.kx.com/forums/topic/debugging-embedpy-library-extension-called-extendpy

Hi all

I try to hack and learn how to debug python library loaded to q kdb+ context.

I use michaelsimonelli/qoinbase-q: Q client for the Coinbase Pro API (github.com) as a sample to

learn from.

 

While hacking I discovered Interesting insights:

  1. embedPy doesn’t work with conda python 3.9 on win 10 x64 bit.

  2. embedPy is working with base python environment - never with conda virtual env

so you must erase all python 3.9 base environments on windows machine to make it work.

  1. embedPy is working with conda python 3.8.10 as base env.

  2. A python package that work well with embedPy on linux will probably fail on windows

example:

qcoinbase fails to view and use the PublicClient module

(py38q) E:workpy38qoinbase-q>%QCMD% C:Userssrv.condaenvspy38qqpackagesqoinbase-qcbpro.q
KDB+ 4.0 2021.11.04 Copyright (C) 1993-2021 Kx Systems
w64/ 16(16)core 16160MB EXPIRE 2022.12.02

2022.02.22T09:15:31.316 [Py] Imported module ‘builtins’
2022.02.22T09:15:31.316 [Py] Mapped functions (builtins; list, next, vars, str) in .py context 2022.02.22T09:15:31.450 [Py] Imported module 'cbpro' 2022.02.22T09:15:31.528 [Py] Reflected module 'cbpro' to cbpro context
.

q)key .cbpro AuthenticatedClientCBProAuthOrderBookPublicClientWebsocketClient

q)cb:.cbpro.PublicClient[] 'cxt [4] C:Userssrv.condaenvspy38qqextend.q:181: <a href="{.py.reflection.priv[y;&#96;cxt][x;z]}&quot;" target="&quot;_blank&quot;" rel="&quot;noopener&quot; noopener">.py.reflection.priv.context@:{.py.reflection.priv[y;cxt][x;z]}

seams `ctx is not recognized.

 

 

I am searching for someone to help me hack the path and understand how to make it work on windows

My hacking goal is to understand how the context ``cxt parameter flows in to the module.

 

Does anyone like to join hacking?

 

Ori