@sdetweil - apologies not necessary - I am just happy you are able to look at it.
Hurrah! It works!
@sdetweil - apologies not necessary - I am just happy you are able to look at it.
Hurrah! It works!
But even with that _ removed, I am still getting an odd error:
TypeError: this.file is not a function
@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)
@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
}
},
@sdetweil super. thanks for the pointer.
@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.
@sdetweil that works, but the setup refreshes itself by default, so it wouldn’t last too long.
I will work it through. Thanks
@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.
@sdetweil I have just had that lightbulb switch on in my head…
@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)
@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)
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.
@sdetweil I will have a go with that, but I think I have a slightly different problem of my own making.
@sdetweil ok, I will try it there then and see what happens.
Tracking down errors in this MM OS is fun…
@sdetweil I am using python3 and I have updated the two references to ‘python’ -> ‘python3’ to reflect this
@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.
@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.
@SDETWEIL, firstly, thank you for creating such a simple to follow module for talking to python. I have been trying to get that working for a while and was struggling.
My issue is that I require a specific library (zeep) for my python code to work, but if I include it in the code with the line include zeep , the module throws an error.
[01.04.2022 16:45.32.503] [LOG] MMM-PythonPrint received a socket notification: CONFIG - Payload: [object Object]
[01.04.2022 16:45.32.507] [LOG] PythonPrint spawning /opt/magic_mirror/modules/MMM-PythonPrint/test.py
[01.04.2022 16:45.32.606] [ERROR] Whoops! There was an uncaught exception...
[01.04.2022 16:45.32.614] [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:394: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)
Now, my python code runs successfully from the command line and I have commented everything else out while troubleshooting. I also see the same behaviour if I add the include zeep line into your sample .py files, which run correctly without this.
Any ideas what is going on? Could it be a path/user/install issue with the python module?
Cheers, RobCee