I was trying to run some python script from electron app in windows 10.The sample code that I am trying to run is:
let {PythonShell} = require('python-shell')
PythonShell.run('test.py', function (err, results) {
if (err) throw err;
console.log('test.py finished.');
console.log('results', results);
});
The code is expected to run test.py which contains a simple print statement.But the terminal shows the following error log:
throw er; // Unhandled 'error' event
^
Error: spawn py ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)