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

MMM-PythonPrint customisation

Scheduled Pinned Locked Moved Solved Troubleshooting
46 Posts 5 Posters 15.5k 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.
  • R Offline
    RobCee @sdetweil
    last edited by Apr 12, 2022, 11:30 AM

    @sdetweil - apologies not necessary - I am just happy you are able to look at it.

    Hurrah! It works!

    1 Reply Last reply Reply Quote 0
    • D Offline
      diemen112
      last edited by Jul 15, 2022, 12:52 PM

      i have also the MM os and i try to make it work
      I have added - /usr/bin/python3:/usr/bin/python3 to the docker compose
      and now i have the error

      [15.07.2022 14:23.42.599] [LOG]   MMM-PythonPrint received a socket notification: CONFIG - Payload: [object Object]
      [15.07.2022 14:23.42.602] [LOG]   PythonPrint spawning /opt/magic_mirror/modules/MMM-PythonPrint/print_test.py using python3
      [15.07.2022 14:23.42.686] [LOG]   PythonPrint program error=Could not find platform independent libraries <prefix>
      Could not find platform dependent libraries <exec_prefix>
      Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
      Fatal Python error: initfsencoding: unable to load the file system codec
      ModuleNotFoundError: No module named 'encodings'
      
      Current thread 0x76fb37a0 (most recent call first):
      

      a played around with adding $PYTHONHOME to env but without any result
      does anyone know a work around to find the libraries?

      S K 2 Replies Last reply Jul 15, 2022, 2:13 PM Reply Quote 0
      • S Away
        sdetweil @diemen112
        last edited by sdetweil Jul 15, 2022, 2:15 PM Jul 15, 2022, 2:13 PM

        @diemen112 I think this answers
        https://askubuntu.com/questions/905372/could-not-find-platform-independent-libraries-prefix

        running under docker is a fun experience?

        did u install python as part of the container startup?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • K Offline
          karsten13 @diemen112
          last edited by Jul 15, 2022, 6:01 PM

          @diemen112 said in MMM-PythonPrint customisation:

          I have added - /usr/bin/python3:/usr/bin/python3 to the docker compose

          this will not work. You have to use the fat image, see my post above (Apr 11)

          1 Reply Last reply Reply Quote 0
          • D Offline
            diemen112
            last edited by diemen112 Jul 15, 2022, 8:18 PM Jul 15, 2022, 7:51 PM

            Thank you for the help,
            I made it work with adding some python dependent directory’s to the docker-compose file

            1 Reply Last reply Reply Quote 1
            • K Offline
              kayakbabe
              last edited by kayakbabe Sep 10, 2022, 10:04 PM Sep 10, 2022, 10:03 PM

              Sam,

              Thank you for this MMM-PythonPrint. More than the sample module this really helped me follow how to wrap my head around how the script.js node_helper and anything else work together. The way you worded the variables and the input and output text really made sense and made it easy to follow what is happening. I am learning a lot. Again, Thank you.

              Kelly

              S 1 Reply Last reply Sep 10, 2022, 10:39 PM Reply Quote 1
              • S Away
                sdetweil @kayakbabe
                last edited by Sep 10, 2022, 10:39 PM

                @kayakbabe awesome, glad it helped!

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                K 1 Reply Last reply Sep 11, 2022, 12:36 AM Reply Quote 0
                • K Offline
                  kayakbabe @sdetweil
                  last edited by Sep 11, 2022, 12:36 AM

                  @sdetweil I’m looking at the configuration variable repetative and trying to figure out what it is for.

                  is this correct logic for true and false?

                  repetative: true
                  if your python script runs in a loop forever by itself so the spawn in node helper will just keep its connection to the python script open

                  repetative: false
                  if your python script runs one time, and you need node_helper to keep spawning over and over so you can get the info from the python script over and over

                  S 1 Reply Last reply Sep 11, 2022, 1:07 AM Reply Quote 0
                  • S Away
                    sdetweil @kayakbabe
                    last edited by sdetweil Sep 13, 2022, 12:02 PM Sep 11, 2022, 1:07 AM

                    @kayakbabe so , maybe your python script starts and runs, prints one line, and ends. current temp is x

                    is that all you want your module to present, one line?

                    or do you want the output every few seconds minutes

                    this is repetative:false, but my module will rerun the script every cycle time milliseconds

                    but some python scripts do that internally.

                    print, sleep, print, sleep, print, sleep, print…

                    this is repetative: true
                    my module will just start the python script

                    there are two different ways to capture the output

                    should have named parm

                    script_is_long_running

                    I provided a sample of each

                    also, in many cases, you are using someone else’s script and don’t have control over how it works, and don’t want to rewrite it

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 1
                    • 1
                    • 2
                    • 3
                    • 4
                    • 5
                    • 5 / 5
                    • 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