This commit is contained in:
Andy Hanson
2017-02-21 14:48:55 -08:00
parent 3b78e2471f
commit d8e24352f7
63 changed files with 648 additions and 668 deletions
+4 -4
View File
@@ -2,7 +2,7 @@ import * as ps from 'python-shell';
let PythonShell = ps.PythonShell;
ps.run('my_script.py', function (err) {
ps.run('my_script.py', err => {
if (err) throw err;
console.log('finished');
});
@@ -15,7 +15,7 @@ var options = {
args: ['value1', 'value2', 'value3']
};
ps.run('my_script.py', options, function (err, results) {
ps.run('my_script.py', options, (err, results) => {
if (err) throw err;
// results is an array consisting of messages collected during execution
console.log('results: %j', results);
@@ -26,13 +26,13 @@ var pyshell = new PythonShell('my_script.py');
// sends a message to the Python script via stdin
pyshell.send('hello');
pyshell.on('message', function (message) {
pyshell.on('message', 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) {
pyshell.end(err => {
if (err) throw err;
console.log('finished');
});