Read the statement by Michael Teeuw here.
How to have Python and JS talk to each other?
-
Hi all,
I have a question for the JS / Python pros out there:
I have a python program doing some long lasting process and consistently printing out the progress of its work to the console. (I have it running in a tmux virtual shell)
I was wondering what would be the best way to “include” this program into a mirror module.A first step would be to pass on the python stdout print to a JS module.
What is the best way for that?
Is there any way for a python program to “talk” to my JS module?Thanks for any help or hints!
-
@lavolp3 in JavaScript, node_helper use the spawn function, and handle.stdout.on() method to get called when there is data from the python script
https://www.freecodecamp.org/news/node-js-child-processes-everything-you-need-to-know-e69498fe970a/
-
@sdetweil Great! Will have a look at it. Thank you Sam!
-
@lavolp3 you can have a look into https://github.com/paviro/MMM-Facial-Recognition/blob/master/node_helper.js which is doing the communication between the python script and module
-
@strawberry-3-141 and that uses a larger wrapper of python scripts called PythonShell