When in comes to Web Development nothing beats JavaScript. But sometimes we have to do a bit more demanding task, for example analyzing big pile of...
For further actions, you may consider blocking this person and/or reporting abuse
i was working on a similar project that i needed to pass data from node js to a python script, i think you may use flask better and create an endpoint to send and receive data between them, it can help you in using asynchronous functions
great approach
Or just use Python and Flask :) A much more pleasant way to develop web apps than Node :) Everything web doesn't have to be JavaScript
Or aiohttp which is faster and has native asyncio support.
You have to make async process queue in Python side for this approach. In other case it will work wrong because node.js has shared context among clients and Python instance going to be shared because you execute it in global context. Other option is execute Python in callback or use messaging queue like rabbitmq.
I agree partially with the other comments, an easier and maybe more elegant approach could be to use just python with a framework in the backemd, but I find your article very useful for existing legacy project in nodejs where you need to run something in python (i.e. data processing, ml flows, etc), because sometimes it is more convenient and faster than to create a microservice. Thanks for the article, keep writing 🙌.
Many thanks 💓
related to this topic ... filebus uses a file watcher to notify each-other when either NodeJS sent something to process, or Python did ... have a look 👋
Or you can run apache kafka and get an extremely fast, scalable and stable communication tunnel between your processes instead of shit described above.
Kafka is much more harder to maintain, and can increase the product cost.
So maybe the "shit" described above is can fit better than your "shit"
I think when sending data TO the python process, you'll need to write to
stdout
(on the node side) rather thanstdin
Generally you write to stdout and read from stdin
Wonderful idea
Very interesting. Had no idea this can happen
I was also thinking about this from the last few weeks. Nice to have it here. 🥰
Glad you found it.