MagicMirror² v2.7.0 is available! For more information about this release, check out this topic.

Python in to the magic mirror.


  • Module Developer

    @paulvanderheijden90
    Crashing? show me the error log.



  • @sean said in Python in to the magic mirror.:

    Crashing? show me th

    App threw an error during load
    /home/pi/MagicMirror/modules/MMM-P2000/node_helper.js:76
    }.call(this, exports, require, module, __filename, __dirname); });
                                                                ^
    
    SyntaxError: missing ) after argument list
        at createScript (vm.js:80:10)
        at Object.runInThisContext (vm.js:139:10)
        at Module._compile (module.js:606:28)
        at Object.Module._extensions..js (module.js:653:10)
        at Module.load (module.js:561:32)
        at tryModuleLoad (module.js:504:12)
        at Function.Module._load (module.js:496:3)
        at Module.require (module.js:586:17)
        at require (internal/module.js:11:18)
        at loadModule (/home/pi/MagicMirror/js/app.js:127:17)
    Whoops! There was an uncaught exception...
    /home/pi/MagicMirror/modules/MMM-P2000/node_helper.js:76
    }.call(this, exports, require, module, __filename, __dirname); });
                                                                ^
    
    SyntaxError: missing ) after argument list
        at createScript (vm.js:80:10)
        at Object.runInThisContext (vm.js:139:10)
        at Module._compile (module.js:606:28)
        at Object.Module._extensions..js (module.js:653:10)
        at Module.load (module.js:561:32)
        at tryModuleLoad (module.js:504:12)
        at Function.Module._load (module.js:496:3)
        at Module.require (module.js:586:17)
        at require (internal/module.js:11:18)
        at loadModule (/home/pi/MagicMirror/js/app.js:127:17)
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    Launching application.
    
    
    

  • Module Developer

    @paulvanderheijden90 said in Python in to the magic mirror.:
    Your log is telling you what is wrong.
    See the 76 line of node_helper.js. There could be missing ) after argument list.



  • @sean So sorry you’re totally right… I was little bit confused by all the “at” conclusens.
    Im sorry I could had fixed that. And I did !

    Now it is working !!!
    So very nice ! im going to put this in my P2000 Raspberry python Programma. and will heave a lot of play with it.

    I will post/ show you the and result !



  • Hello @Sean,
    Again thank you for the help. As I say after your help it was possible for me to “print” a string variable on the magic mirror module through python.
    But is was not able to put my P2000 alarm from the fire department on my screen. I noticed that it was a problem in the python script of the alarm.
    I used the stdout.write function again. like you told me. but I needed to add the flush function as wel.
    so now it is

    sys.stdout.write("hallo ik ben Paul")
    sys.stdout.flush()
    
    

    And then it was working !
    so thank you and here the result:



  • @sean
    Hello Sean,
    like I posted yesterday the app is running now. And it is showing wat I need to display. So im very happy.

    But…
    After a time ( more after a couple of runs ) the magic mirror app is crashed and freezed. So noting is updating any more.

    My feeling is telling that the buffer were I put in the string value is filling up.

    wenn i run the python script without the mirror it is running fine.

    Please can you give me a help?


  • Module Developer

    @paulvanderheijden90
    I have no idea about Python. I think you’d better reboot once or twice per daily to maintain RPI to be stable. You can do it with cron automatically.
    The better approach would be implementing your job as native nodeJS MagicMirror module instead external python script.



  • @paulvanderheijden90 can u put your project on github and tell me where it is… I will look at it later today (us time)



  • @sdetweil
    Hallo Thank you for you’re Replay

    I managed to upload the project on git hub ( new experience for me )
    I uploaded the magic mirror Module ( P2000) I made and the node helper.

    And I added the Python project.

    The python project works fine on it self. But wenn I call ( spawn ) the python. The magic mirror application stops and freezes.

    I think the flush/write fills the buffer and wenn it is it full the application is stoped.

    https://github.com/paulvanderheijden90/MMM-P2000-python-connect

    Here is the link



  • sorry, the is no PUBLIC repo there