Answers for "run python script from typescript"

0

run python script from typescript

var myPythonScriptPath = 'script.py';

// Use python shell
var PythonShell = require('python-shell');
var pyshell = new PythonShell(myPythonScriptPath);

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');
});
Posted by: Guest on July-18-2021

Code answers related to "run python script from typescript"

Python Answers by Framework

Browse Popular Code Answers by Language