Following is a part of the nodejs script.
const util = require('util');
const exec = util.promisify(require('child_process').exec);
fs.writeFile( filepath, dom.window.document.querySelectorAll("note")[i].textContent, function(err) {
if(err) { return console.log(err); }
});
const text_content = dom.window.document.querySelectorAll("note")[i].textContent ;
async function exec_python3() {
const { stdout, stderr } = await exec(`bash -c 'python3 ${filepath}'`);
text_content = stdout ;
}
exec_python3() ;
dom.window.document.querySelectorAll("note")[i].textContent
is a jsdom object.
What I want to do is replace content in dom.window.document.querySelectorAll("note")[i].textContent
with stdout of executed Python3.
For example, currently value of dom.window.document.querySelectorAll("note")[i].textContent
is print("foo")
and the value will be foo
after exec_python3() ;
.
But above script occurs error Assignment to constant variable.
. I have no idea what I have to do, any idea? thanks.