• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Run Python script which creates a JSON file

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 1.8k Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    ooom416354
    last edited by Mar 7, 2017, 2:08 PM

    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

    1 Reply Last reply Reply Quote 0
    • Y Offline
      yawns Moderator
      last edited by Mar 7, 2017, 2:16 PM

      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

      O 1 Reply Last reply Mar 7, 2017, 2:22 PM Reply Quote 0
      • O Offline
        ooom416354 @yawns
        last edited by Mar 7, 2017, 2:22 PM

        @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.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          1/3
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Sam, technical setup by Karsten.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy