I have a python script which can be run with this argument on the command line:
python2 arg1 --infile abc.csv --encrypt true --keyfile xyz.bin 1234 WOW path
However, if I try to do the same thing from Node.js child process, I get an error:
const spawn = require("child_process").spawn;
const process = spawn("python2", [
path.join(rootDir, "public", "python", "script.py"),
"arg1",
"--infile abc.csv",
"--encrypt true",
"--keyfile xyz.bin",
"1234",
"WOW",
"path",
]);
It is not running and giving an error. But, If I run without the NAMED ARGUMENTS (--encrypt true) etc, it runs successfully:
const process = spawn("python2", [
path.join(rootDir, "public", "python", "script.py"),
"arg1",
"1234",
"WOW",
"path",
]);
I think my way of passing the NAMED args might be incorrect. Please help!