@sdetweil thanks for the response. that doesn’t seem to be working either.
Is there something I need to install to be able to use stdout?
Read the statement by Michael Teeuw here.
Posts
-
RE: child_process won't execute
-
RE: Module creation workflow - Newbie
@sdetweil How can I construct ModuleName as an html?
-
child_process won't execute
I’m trying to execute a python script using the child_process. However my function doesn’t seem to be triggering.
const spawn = require("child_process").spawn var NodeHelper = require("node_helper") const process = spawn("python3", ["return_something.py"]) module.exports = NodeHelper.create({ start: function() { this.countDown = 10000000 }, socketNotificationReceived: function(notification, payload) { switch(notification){ case "DO_YOUR_JOB": console.log(payload) this.sendSocketNotification("I_DID", (this.countDown - payload)) break case "RETRIEVE_DATA": console.log(payload) this.job() break } }, job: function(){ console.log("I'm trying to retrieve data") process.stdout.on('data', (data)=>{ //********everything works up till here console.log("inside") var result = String.fromCharCode.apply(null, new Uint16Array((data))) this.sendSocketNotification("DATA_RETRIEVED", result) }) } })
Python script.
import sys print("Hello, I'm Amira") sys.stdout.flush()
-
Module creation workflow - Newbie
Hello all. I’m currently trying to build a custom module. I’ve been trying to wrap my head around it for a few days but I think I finally have a decent understanding. I’m not that familiar with node.js so my question might sound stupid. I understand that the MMM-ModuleName.js pretty much passes data or documents to the main html. Is it possible to have an html file with custom html already defined, a table of data for example, load it in your MMM-ModuleName.js using nodejs, modify the contents using the elementid and then pass that to the main html? As opposed to creating the html using nodejs. Again, I’m pretty green when it comes to nodejs please forgive me.