Last active
March 2, 2017 03:18
-
-
Save dianjuar/a6a815e5347d5c6de236b8393e6aa575 to your computer and use it in GitHub Desktop.
Comunicate python process with asyncronush calls with nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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