I am trying to "spawn" a python script in Node.JS. The python script accepts multiple file paths as args. This command works:
python3 script.py 'path1' 'path2' 'path3'
In node, I am given a var with the paths:
args = ["path1", "path2", "path3"]
But when I try to spawn the script:
var spawn = require("child_process").spawn;
var pyspawn = spawn(
'python3', [pyscript.py, args]
);
But this appears to issue the command:
python3 script.py [path1,path2,path3]
Tinkering with various concat()s, join()s, and toString()s I can get stuff that looks like:
python3 script.py "'path1' 'path2' 'path3'"
... but cant for the life of me figure how to do this simply
via Trees4theForest
No comments:
Post a Comment