Run Python script which creates a JSON file



  • Hi, I am trying to test something and am wondering the best way to do it (unrelated to node/mirror). I have an HTML page with a button and a JavaScript file which parses a local JSON file and presents results on screen. I also have a Python script which I run prior which creates the local JSON file. Is there a way for me to click this button in my HTML, run the Python script which creates the file then run my JavaScript file which shows the output?

    Thank you


  • Moderator

    You could do it the other way round. Your MagicMirror javascript module could run the python script and wait for its output/result.
    See here: https://forum.magicmirror.builders/topic/1981/python-to-javascript



  • @yawns Ahhh perfect - I am going to try that, that should definitely work when implementing on the mirror. But for now I am actually just trying to test this very primitive code to see if it is possible the other way around. I have seen an ajax call needed but am not 100% sure as to where I’d put that in the code or how it would be configured to just run a local python file which outputs nothing but another file.


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.