Read the statement by Michael Teeuw here.
MMM-PythonPrint customisation
-
@sdetweil I thought it would be something daft like this. Thanks for the pointer, I will take a look and see if I can resolve it.
Super speedy response too. -
S sdetweil referenced this topic on
-
S sdetweil referenced this topic on
-
@RobCee were you able to resolve the exec of the python script?
-
@sdetweil I haven’t managed to get it running yet.
I did have some success (I had it printing Hello on the screen), but then the wheels came off and I have been unable to get it working again.I have reverted to the default configuration from your Github page to try and wiork out what is going on, but I am seeing the following in the logs:
[11.04.2022 16:30.34.903] [LOG] Connecting socket for: MMM-PythonPrint [11.04.2022 16:30.34.907] [LOG] Starting module helper: MMM-PythonPrint [11.04.2022 16:30.43.341] [LOG] MMM-PythonPrint received a socket notification: CONFIG - Payload: [object Object] [11.04.2022 16:30.43.346] [LOG] PythonPrint spawning /opt/magic_mirror/modules/MMM-PythonPrint/printitonce.py [11.04.2022 16:30.43.531] [ERROR] Whoops! There was an uncaught exception... [11.04.2022 16:30.43.556] [ERROR] ReferenceError: data is not defined at ChildProcess.<anonymous> (/opt/magic_mirror/modules/MMM-PythonPrint/node_helper.js:20:65) at ChildProcess.emit (node:events:390:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12) at onErrorNT (node:internal/child_process:477:16) at processTicksAndRejections (node:internal/process/task_queues:83:21)Which seems to be the same error as before, but now I am not using any 3rd party modules, just the sample code.
-
@RobCee said in MMM-PythonPrint customisation:
ReferenceError: data is not defined
are u launching ‘python’ or python3?
the default
const python=‘python’ -
@sdetweil I am using python3 and I have updated the two references to ‘python’ -> ‘python3’ to reflect this
-
@RobCee right, you don’t have to change the code, just use the config.js setting
{ module: config: { pythonName:'python3', } } -
@sdetweil ok, I will try it there then and see what happens.
Tracking down errors in this MM OS is fun… -
@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 -
@sdetweil I will have a go with that, but I think I have a slightly different problem of my own making.
-
@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 -
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. -
@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
-
@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) -
@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
-
@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) -
@RobCee you had to install python in the container if it wasn’t as part of the instance
-
@sdetweil I have just had that lightbulb switch on in my head…
-
@RobCee i don’t think the image has python installed
-
@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
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