I am using the following code to run a python from node. The code works fine as a separate file but when I put it in a VSCode Extension (extension.js), it says graph.py not found.
const {spawn} = require('child_process')
const child = spawn('python3', ['graph.py'])
child.stdout.on('data', (data)=>{
console.log(`stdout: ${data}`)
})
child.stderr.on('data', (data)=>{
console.log(`stderr: ${data}`)
})
child.on('error', (error)=> console.log(`error: ${error.message}`))
child.on('exit', (code, signal)=>{
if(code) console.log(`Process exit with code: ${code}`)
if(signal) console.log(`Process killed with signal: ${signal}`)
console.log(`DONE!!`)
})
Does anyone know how to fix it? TIA.