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.

    MMM-PythonPrint customisation

    Scheduled Pinned Locked Moved Solved Troubleshooting
    46 Posts 5 Posters 20.9k Views 5 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.
    • S Do not disturb
      sdetweil @RobCee
      last edited by sdetweil

      @RobCee o, I see that I have a potential bug… if the command: is not configured,
      it defaults to “”… oops…

      I just pushed an update got that

      git pull in the module folder

      to debug

      add debug: true

      and then look where u start MM… (this doing npm start )

      [11.04.2022 10:55.13.087] [LOG]   MMM-PythonPrint received a socket notification: CONFIG - Payload: [object Object]
      [11.04.2022 10:55.13.087] [LOG]   PythonPrint spawning modules/MMM-PythonPrint/printit.py
      .
      .
      .
      .
      [11.04.2022 10:55.18.114] [LOG]   PythonPrint sending program output=hello
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      R 1 Reply Last reply Reply Quote 0
      • R Offline
        RobCee @sdetweil
        last edited by

        @sdetweil I will have a go with that, but I think I have a slightly different problem of my own making.

        S 1 Reply Last reply Reply Quote 0
        • S Do not disturb
          sdetweil @RobCee
          last edited by sdetweil

          @RobCee ok, I also fixed the use of the pythonName and added it to the debug message

          [11.04.2022 11:04.20.218] [LOG]   PythonPrint spawning modules/MMM-PythonPrint/printit.py using python3
          .
          .
          .
          .
          [11.04.2022 11:04.25.244] [LOG]   PythonPrint sending program output=hello
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • R Offline
            RobCee
            last edited by

            I’m not sure why, as I did manage to get it working at one point, but I think the issue is that I am using the MM OS Docker image to run all this.
            I think this means that the path expectations are different from the assumptions that I am making.
            I may have to give in and just build the whole thing manually - it will probably be quicker than trying to fault find the install, given it’s obfuscation.

            S 1 Reply Last reply Reply Quote 0
            • S Do not disturb
              sdetweil @RobCee
              last edited by

              @RobCee yes, docker paths and if OUTSIDE the MM tree, then YOU have to add new volume statements to the docker setup to map them

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              R 1 Reply Last reply Reply Quote 0
              • R Offline
                RobCee @sdetweil
                last edited by RobCee

                @sdetweil yeah, I am deliberately keeping all the module paths in the default place, but it still doesn’t like it.
                But if I go into the docker container, it doesn’t seem to have access to Python, so maybe that’s the problem.
                It is all rather confusing. (More so from your end, no doubt)

                S 2 Replies Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @RobCee
                  last edited by sdetweil

                  @RobCee this.file(filename) will prepend the file system path to the module folder

                  I just pushed a fix to do the same in the module, instead of the __dirname prefix

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  R 1 Reply Last reply Reply Quote 0
                  • R Offline
                    RobCee @sdetweil
                    last edited by

                    @sdetweil But if I exec into a bash console in the docker container, it doesn’t seem to have access to Python, so maybe that’s the problem.
                    It is all rather confusing. (More so from your end, no doubt)

                    1 Reply Last reply Reply Quote 0
                    • S Do not disturb
                      sdetweil @RobCee
                      last edited by

                      @RobCee you had to install python in the container if it wasn’t as part of the instance

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      R 1 Reply Last reply Reply Quote 0
                      • R Offline
                        RobCee @sdetweil
                        last edited by

                        @sdetweil I have just had that lightbulb switch on in my head…

                        S 1 Reply Last reply Reply Quote 0
                        • S Do not disturb
                          sdetweil @RobCee
                          last edited by

                          @RobCee i don’t think the image has python installed

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          R 1 Reply Last reply Reply Quote 0
                          • R Offline
                            RobCee @sdetweil
                            last edited by

                            @sdetweil you are correct. It doesn’t have python installed with it.
                            My next challenge is to work out how to get that up and running.

                            Once I have it running I will get back to you on your module.

                            S 1 Reply Last reply Reply Quote 0
                            • S Do not disturb
                              sdetweil @RobCee
                              last edited by sdetweil

                              @RobCee short term while u are execed in, install python as usual

                              if you are using https://gitlab.com/khassel/magicmirror

                              he doesn’t provide a mechanism to add system components like python

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              R karsten13K 2 Replies Last reply Reply Quote 0
                              • R Offline
                                RobCee @sdetweil
                                last edited by

                                @sdetweil that works, but the setup refreshes itself by default, so it wouldn’t last too long.
                                I will work it through. Thanks

                                S 1 Reply Last reply Reply Quote 0
                                • S Do not disturb
                                  sdetweil @RobCee
                                  last edited by

                                  @RobCee while its challenging, its possible

                                  I might open an issue of the docker image to allow a folder/file with additional packages to install at startup…

                                  seems a waste to do it every refresh time tho

                                  long ago and far away (2015) I had a product to install in an image, 1.5 GIG of product, and didn’t want to make a separate image for the different versions…

                                  so I figured out how to install and capture that as a tarfile, and then
                                  untar it as part of the startup…

                                  then the start script passed that as a parm to startup, so I could change the product on the fly, using the same tiny image…

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  R 1 Reply Last reply Reply Quote 0
                                  • R Offline
                                    RobCee @sdetweil
                                    last edited by

                                    @sdetweil it may just be quicker for me to learn how to do what my python code does in .js
                                    It probably isn’t that complex. It is only reading stuff from web services and reporting it locally. I had hoped I could skip that stage, but I guess there are no short-cuts.

                                    S 1 Reply Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @RobCee
                                      last edited by

                                      @RobCee you can do most of the dev and test using a local file , outside of MM

                                      xxx.js
                                      then
                                      node xxx.js

                                      at least to get your main function working…

                                      this code would work in the node helper

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      R 1 Reply Last reply Reply Quote 0
                                      • R Offline
                                        RobCee @sdetweil
                                        last edited by

                                        @sdetweil super. thanks for the pointer.

                                        1 Reply Last reply Reply Quote 0
                                        • karsten13K Offline
                                          karsten13 @sdetweil
                                          last edited by karsten13

                                          @sdetweil

                                          the docker image karsten13/magicmirror:latest doesn’t contain python. Simplest solution for this is to use the fat image karsten13/magicmirror:fat, for more infos: https://khassel.gitlab.io/magicmirror/images/

                                          S 1 Reply Last reply Reply Quote 1
                                          • S Do not disturb
                                            sdetweil @karsten13
                                            last edited by

                                            @karsten13 thanks… the doc needs help tho

                                            The difference between latest and fat is image size and installed

                                            those words are not used above that sentence, and so didn’t mean anything to me…

                                            I would propose adding in front of that sentence

                                            There are two images of each type created
                                            
                                            latest and fat 
                                            docker pull image_name:latest 
                                            or
                                            docker pull image_name:fat 
                                            

                                            and then I would add a new line between these sentences

                                            debian packages. For most use cases the latest image is sufficient. 
                                            Some modules need dependencies which are not includes in latest, e.g
                                            

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            karsten13K 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              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