hmenyus/node-calls-python

Unable to import python file

Closed this issue · 1 comments

Iam using node version 18.16. My python version is 3.10. These are the logs related to ncp when i used NODECALLSPYTHON_DEBUG as an environment variable.

Loading python from /usr/lib/python3.10/config-3.10-x86_64-linux-gnu
Running fixlink on /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so

I was trying to import a python file and the ncp module repeatedly throwed an error saying list index out of range.

code snippet used to import the python file :

const nodecallspython = require("node-calls-python");
const pythonPy = nodecallspython.interpreter;
const filePath = path.join(__dirname, "./sample.py");
await pythonPy.import(filePath).then(async function (pymodule) {
      try {
          await pythonPy.call(pymodule, "myfunc", args);
     }
      catch (err) {
          console.log(err);
      }
});

This looks like a regular python error : "list index out of range". please check your code in sample.py and the provided arguments in args.