1

I am new to node js and python just i want to communicate node js to python and vice versa. I need simple script that runs and host on web browser to get executed python script in node js. Just wan to transfer one message from node js to python using after running node js script with hosted envirnoment.

1 Answer 1

2

You need to execute python code from nodejs using system call.

var exec = require('child_process').exec;
var cmd = 'python myscript.py';

exec(cmd, function(error, stdout, stderr) {
  // command output is in stdout (This the output from the python script that you might use
});
Sign up to request clarification or add additional context in comments.

13 Comments

from bottle import route, run, template @route('/hello/<name>') def index(name): return template('<b>Hello {{name}}</b>!', name=name) run(host='localhost', port=8085)
Above one is script from that how should i call to node js?
Save this code to file like run.py or main.py var cmd = 'python main.py or run.py'; give the absolute file path
Do you want the output ? Like running on port 8085 ? or you just want to start the bottle server ?
Yes i want running on port which gives an python url
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.