I'm trying to run a Python script within Javascript code and in order to do it, I need to have a virtual environment set up in Python.
I have a Python3.10 folder in the following directory ./stability/lib/python3.10
My current code is
const data_to_pass_in = '-W 512 -H 512 "A stunning house."';
const python_env = "./stability/lib/python3.10"
app.get("/api", (req, res) => {
const python_process=spawner(python_env, ["./calculation.py", data_to_pass_in]);
python_process.stdout.on('data', (data) => {
console.log('Data recieved from python script:', data.toString());
});
console.log('Data sent to python script:', data_to_pass_in);
res.sendFile(__dirname + "/file.png")
})
However when I run this, I get:
errno: -13,
code: 'EACCES',
syscall: 'spawn ./stability/lib/python3.10',
path: './stability/lib/python3.10',
spawnargs: [ './client.py', '-W 512 -H 512 "A stunning house."' ]
The Python code, client.py I am trying to execute is available here: https://github.com/Stability-AI/stability-sdk
Any help is appreciated!