File size: 463 Bytes
ec2d906
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env node
var python = require('../lib/python').shell;
var mycallback = function(err, data) {
   if (err) {
     console.error(err);
   } else {
     process.stdout.write(data + '\n>>> ');
   }
};
process.stdout.write('Using Python from NodeJS\n>>> ');
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
   python(chunk, mycallback);
});

process.stdin.on('end', function() {
   python('quit()');
});