error running endless python script #81
Copy link
Copy link
Closed
Description
Activity
Me too, nothing happened when executing a script, onMessage not working
That's worked for me
def emit_values(): point = { # what ever you emit } print(json.dumps(point)) sys.stdout.flush() #<------SUPPER IMPORTANT!!! threading.Timer(interval, emit_values).start() if __name__ == '__main__': ap = argparse.ArgumentParser() ap.add_argument("-i", "--interval", type=int, default=60, help="sample interval") threading.Timer(args.interval, emit_values).start()Hope it helps
Reacted by Anh Quoc Tran, Rohan D. Kekatpure, Almenon and Malcolm MacArthurOK, good, that also worked for me, thank you bro
alternatively/in addition you can also set
pythonOptionsto include-uwhen creating a new python shellconst pyshell = new PythonShell('script.py', { pythonOptions: '-u' //disable python output buffering });Reacted by Anh Quoc Tran, Corey Gwin, Rohan D. Kekatpure, Vanojx1, Asad Memon and AlmenonThanks @zoellner and @moshebeeri . Closing.
Metadata
Metadata
Assignees
Labels
No labels
for example: