How to embed python-shell in a web page?

Viewed 676

Recently I found python-shell a python interpreter. A simle implementation using python-shell is as follows:

var PythonShell = require('python-shell');
var pyshell = new PythonShell('my_script.py');

pyshell.on('message', function (message) {
  // received a message sent from the Python script (a simple "print" statement)
  console.log(message);
});

// end the input stream and allow the process to exit
pyshell.end(function (err) {
  if (err) throw err;
  console.log('finished');
});

But since the require method is not applicable for web pages, how should it be embedded in the application?

0 Answers
Related