This commit is contained in:
Andy Hanson
2017-02-21 14:48:55 -08:00
parent d4ebf9758d
commit e31de7654c
61 changed files with 442 additions and 430 deletions
+7 -7
View File
@@ -14,24 +14,24 @@ var options = {
scriptPath: 'path/to/my/scripts',
args: ['value1', 'value2', 'value3']
};
ps.run('my_script.py', options, function (err, results) {
if (err) throw err;
// results is an array consisting of messages collected during execution
// results is an array consisting of messages collected during execution
console.log('results: %j', results);
});
var pyshell = new PythonShell('my_script.py');
// sends a message to the Python script via stdin
// sends a message to the Python script via stdin
pyshell.send('hello');
pyshell.on('message', function (message) {
// received a message sent from the Python script (a simple "print" statement)
// 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
// end the input stream and allow the process to exit
pyshell.end(function (err) {
if (err) throw err;
console.log('finished');