Answer the question
In order to leave comments, you need to log in
How to run py script from js file?
Are there any ways to execute a py (python) file from a js (node.js) file?
Answer the question
In order to leave comments, you need to log in
test.py.js
const { exec } = require('child_process');
exec('python test.py', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
});
count = 0
while count < 1e6:
count = count + 1
print(count)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question