Tom-Hirschberger / MMM-CommandToNotification

A MagicMirror² module which peridocally calls configured scripts and sends the output as notification
MIT License
4 stars 1 forks source link

scripts dependencies not resolved #8

Closed sdetweil closed 4 months ago

sdetweil commented 4 months ago

user trying to use a script, but it has dependencies that were never installed, or documented to be needed...

Tom-Hirschberger commented 4 months ago

Hi Sam, do not exactly now what you mean.

The module itself only uses only dependencies of node.

If a user wants to call a script he needs to take care about the dependencies by him self. If a error occurs the return code or the output contains a pattern the module can send different notifications.

Tom-Hirschberger commented 4 months ago

Found the thread in the forum.

Will add a Readme containing instructions of how to install the deps.

Currently only a comment is in the script itself.

sdetweil commented 4 months ago

right. the user tries to use the script but it will fail if the python libs or system dep not installed

Tom-Hirschberger commented 4 months ago

Done. I added some more documentation to the reame of the example scripts

sdetweil commented 4 months ago

you could tell if the path is absolute, (starts w /)

and not depend on the user for this

Tom-Hirschberger commented 4 months ago

Hi,

sorry but i am again not sure what you mean exactly. There are three scenarios which can happen:

if the user wants to call a script by its relative path the path will look something like:

if the user want to use a script which is part of the PATH there will be no starting ./ or /.

I could add a check if the command does not start with a / but it contains a / it is a relative path. But if the user wants to call a script which is in the scripts directory (which is my working directory for the script calls) and calls it with lets say randomInteger.js i do not know if it is a script in the PATH or in the scripts directory.

sdetweil commented 4 months ago

0k. your doc said absolute or relative

Screenshot_20240427_122714_Chrome

absolute to me means from the root /home/pi/...

relative is anything else

so scripts/dht22.py is relative

doesn't need the ./ you can do that.
if it starts w a dot, then don't add ./

just my opinion.. users don't read, don't know file systems..

just trying to reduce trouble reports and user frustration w things not working

you can also build that path and test it, and report if not found...before trying to execute it

Tom-Hirschberger commented 4 months ago

Your right. That's definitely a point. I think i can add this easily.

Will do this as fast as I can.

Tom-Hirschberger commented 4 months ago

Hi Sam,

just released version 0.0.7 of the module which includes your suggestions of path and permissions checks. It is possible to run scripts either with or without the ./ now.

Needed to take care about a rare edge case if a user wants to call lets say randomNumber.js and puts it in his $PATH to call it. I first check if the script is in the scripts directory now and expect it to be in $PATH it is not there, now.

sdetweil commented 4 months ago

cool. nice work