How to run .py in KX Developer

https://learninghub.kx.com/forums/topic/how-to-run-py-in-kx-developer

Hi community

My problem is:" I can’t open .py in KX Developer."

error: embedPy must be loaded to evaluate Python code

 

My version in Conda base env

kdb 4.0

embedPy 1.5

jupyterq 1.1.13

python 3.9.12

 

that’s my terminal code for q

 

 

that’s my code for Kx developer

 

 

So, how can I fix it?

thanks all

 

Can I use python to call a q database? Or using q to compute python data in the same dialog box?

Have you installed embedpy?

https://code.kx.com/q/ml/embedpy/#build-and-install

Can you load and test it?

\l p.q 
p)print(1+1)

 

There are useful comparisons on this page: https://code.kx.com/pykx/1.3/comparisons.html

 

You can expose python function to q using embedpy

You can do it all in a q file or as I like to do split out to a .py and a .q

Such as: https://github.com/rianoc/qXML

 

kdb+ can also use websockets natively if needed

https://code.kx.com/q/wp/websockets/

It’s work, thanks

Also, I have 3 questions

01/ just like before python code, I download data from ibapi api

I can use q insert to q databases ? in the same dialog box or not ?

Can you give a simple example of Q and PYTHON code

02/ or use python to select data from q databases to trade?

03/ What’s different about embedPy and PYQ?

thanks

you're encountering an issue with running Python scripts in KX Developer due to the embedPy module not being loaded.

To resolve this issue, you need to ensure that embedPy is properly loaded in your KDB environment. You can do this by adding the following line to your q script before attempting to run any Python code:

\l embedPy.q

This line loads the embedPy module, allowing you to evaluate Python code within your q environment.

Once embedPy is loaded, you should be able to run Python scripts in KX Developer without encountering the error you mentioned.

Regarding your question about using Python to call a q database or vice versa, yes, it's possible to integrate Python and q. You can use embedPy to call Python functions from q or vice versa. This allows you to leverage the strengths of both languages within the same environment.

Thank you

stevediazsalesforce cpq

Hey Members,

I was also facing this situation that I also couldn't run .py in KX Developer but my problem got solved by the solutions by @rocuinneagain and @gregbowers .

Thank you for sharing such solutions mates.

(Marcos)

can someone here screenshot the whole process of installing kx developer in cmd windows? help help help?