0

i have to execute python code in protractor to compare two word files. Python code is working fine. How can i execute that python file in javascript file ?

  • 1
    Could you provide some more information, i.e. source code, things you've already tried, etc. Have you looked at similar questions, such as [this](https://stackoverflow.com/questions/20643470/execute-a-command-line-binary-with-node-js)? – JO3-W3B-D3V Jan 03 '19 at 12:38
  • 1
    Possible duplicate of [Execute a command line binary with Node.js](https://stackoverflow.com/questions/20643470/execute-a-command-line-binary-with-node-js) –  Jan 03 '19 at 12:41

1 Answers1

1

Please have a look on this package https://www.npmjs.com/package/python-shell

It provides you a way to call python files from node

dima golovin
  • 262
  • 2
  • 8
  • var exec = require('child_process').exec; var cmd = 'C:/Python27/Scripts/readDoc.py'; exec(cmd, function(error, stdout, stderr) { // command output is in stdout }); this code is working for me ... Thanks – Vinod Kumar Jan 03 '19 at 12:59