Skip to content

Instantly share code, notes, and snippets.

@dianjuar
Last active March 2, 2017 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dianjuar/a6a815e5347d5c6de236b8393e6aa575 to your computer and use it in GitHub Desktop.
Save dianjuar/a6a815e5347d5c6de236b8393e6aa575 to your computer and use it in GitHub Desktop.
Comunicate python process with asyncronush calls with nodejs
var spawn = require('child_process').spawn,
ls = spawn('python',['-u','python.py']);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
import sys
from datetime import datetime
from time import sleep
for x in range(1, 5):
print(datetime.now())
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment