0

This is an electron app and I am trying to execute one python file that just prints "hello world through javascript. I am getting two errors: error 1: main.js:1 Uncaught ReferenceError: require is not defined

error 2: Uncaught ReferenceError: Cannot access 'PythonShell' before initialization

this is the javascript code:

let {PythonShell} = require('python-shell');

function exec_py(){
    console.log("am in");
    PythonShell.run("main_script.py", null, function(err,result){
    console.log(result)
})

}
Ant Tube
  • 7
  • 2
  • Does this answer your question? [Client on Node.js: Uncaught ReferenceError: require is not defined](https://stackoverflow.com/questions/19059580/client-on-node-js-uncaught-referenceerror-require-is-not-defined) – computercarguy Nov 11 '21 at 20:38

0 Answers0