Read the statement by Michael Teeuw here.
MMM-PythonPrint customisation
-
@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.
-
@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
-
@sdetweil that works, but the setup refreshes itself by default, so it wouldn’t last too long.
I will work it through. Thanks -
@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…
-
@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. -
@RobCee you can do most of the dev and test using a local file , outside of MM
xxx.js
then
node xxx.jsat least to get your main function working…
this code would work in the node helper
-
@sdetweil super. thanks for the pointer.
-
the docker image
karsten13/magicmirror:latestdoesn’t contain python. Simplest solution for this is to use the fat imagekarsten13/magicmirror:fat, for more infos: https://khassel.gitlab.io/magicmirror/images/ -
@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:fatand 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 -
yes, the docs … no native english speaker so docs are always a struggle. Thanks for the hints, will update …
-
@karsten13 and I missed the latest/fat under the TAG column of your table… tldr(lol), my apologies
-
@sdetweil I have started fresh and am still having the same issue.
New install of buster, fully updated.
Installed all the MM and node successfully.
MM runs as expected.
Checked that python and python3 are both available to the OS.
Added the MMM-PythonPrint to the modules dir.[12.04.2022 11:22.45.613] [LOG] MMM-PythonPrint received a socket notification: CONFIG - Payload: [object Object] [12.04.2022 11:22.45.619] [ERROR] Whoops! There was an uncaught exception... [12.04.2022 11:22.45.640] [ERROR] ReferenceError: _this is not defined at Class.startit (/home/pi/MagicMirror/modules/MMM-PythonPrint/node_helper.js:27:24) at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-PythonPrint/node_helper.js:46:9) at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:109:11) at Socket.emit (node:events:390:28) at Socket.emitUntyped (/home/pi/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22) at /home/pi/MagicMirror/node_modules/socket.io/dist/socket.js:466:39 at processTicksAndRejections (node:internal/process/task_queues:78:11)This is my config section:
{ module:"MMM-PythonPrint", position:"center", disabled:false, config: { // name of the python process to execute (could be python3) pythonName: 'python', // command file in module folder // if false, YOU will provide the full path to the python program localfolder: true, // spawn a python pgm that writes over and over (timed maybe), but keeps running command: 'printit.py', repetative: true, // spawn a one time output script, but relaunch it every cycletime milliseconds // repretative: false, // command: 'printitonce.py', cycletime: 2000, // print debugging messages from the node_helper debug: true } }, -
@RobCee weird, sorry, typo… fixed
git pull to get the update
-
@sdetweil I found another, just up from that one - you have a missing ‘t’ in this line
this.config.command=this.config.command.slice(his.config.pythonName.length) -
@RobCee fixed… bad day at the finger farm…yikes sorry
-
But even with that _ removed, I am still getting an odd error:
TypeError: this.file is not a function -
@RobCee ok, fixed, tested… sorry again
git pull -
@sdetweil - apologies not necessary - I am just happy you are able to look at it.
Hurrah! It works!
-
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? -
@diemen112 I think this answers
https://askubuntu.com/questions/905372/could-not-find-platform-independent-libraries-prefixrunning under docker is a fun experience?
did u install python as part of the container startup?
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