I am having an issue with my Node.js script in the Cloud9 online IDE. I am using the child_process module to run a python script, pass an input with stdin, and receive an output with stdout. I keep receiving an error. Here is the part of my code in question
Node.js
var spawn = require ("child_process").spawn;
var pyProcess = spawn ("python2", ["pythonScript.py"]);
pyProcess.stdin.write ("Test");
pyProcess.stdout.on ("data", function (data) {
console.log (data);
});
Python
import sys
sys.stdout.write (sys.stdin.read())
sys.stdout.flush()
Error
events.js:141
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:907:11)
at Pipe.onread (net.js:557:26)
When I remove the line
pyProcess.stdin.write ("Test");
the error goes away. Any and all help would be appreciated.
via Peter Russell
No comments:
Post a Comment