Skip to content

Instantly share code, notes, and snippets.

@JaiParakh
Created March 3, 2020 05:34
Show Gist options
  • Save JaiParakh/61dc751e5f06d830d6b87552b83bf39f to your computer and use it in GitHub Desktop.
Save JaiParakh/61dc751e5f06d830d6b87552b83bf39f to your computer and use it in GitHub Desktop.
//We will have to create a childprocess in order tocall python script.
var spawn = require("child_process").spawn;
//This process is called here.
var process = spawn('python',["./add.py",7,3] );
//We listen for 'data' event.
process.stdout.on('data', function (data) {
console.log("Sum " + JSON.parse(data.toString()).sum);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment