Running Python from Node.js in SAP Business Application Studio

Hi Fellow Developers,

In my recent project we come across a requirement where we need to connect Node.js with Python. So, I thought of writing a blog on it.

In below example we will create a simple service where we run Python script and and show “Hello world from python”.

First we need to install python for node modules in our project. Run below command to install python in SAP BAS.

Create simple Python script to print “Hello world from python”

Second Step is to create a service,

After creating the service, let call our service in the html file created in our project. Also call the service where you initialize the port environment. 

(readPython is the file I created for the catching the python script in the get request, the code in the file is shown in the second step after installing python in BAS.)

After that run your service by “npm run start”.

check the response

Conclusion :

In the above blog we learn how to call a python script into our Node js service  through a get call. And we catch the response and show it in console.

Its my first blog, So please provide your esteem feedback and improve my Knowledge. Thank you, Feel free to comment and discuss it further. I might such blog frequently so you can follow for more such content