Hey team,
I running v1.37.6 on ubuntu 18.04.6 and am using a filter to execute a custom python script to post a message to discord. When i run the scripts via command `sudo zmfilter.pl --filter_id=12` (12 being the appropriate filter ID) everything works fine and the message is posted to discord.
However, when I try the execute button in the zoneminder filter, i get an error in the log
`Command 'python3 /home/ben/siddbot/siddbot.py /var/cache/zoneminder/events/4/2021-12-31/554535' exited with status: 1`
I originally thought it was a permissions issue so i gave full access to www-data
$ ls -l siddbot.py
-rwxrwxrwx 1 www-data www-data 889 Jan 3 13:32 siddbot.py
I'm stuck, anyone have any advice on how i can debug this better?
Thanks in advance
Custom Script failing on execute only
Re: Custom Script failing on execute only
thank you so much! Progress at last
--------------------------------------------------------------------------------------
ben@ben-P-7805u:~/siddbot$ sudo -u www-data zmfilter.pl --filter_id=12
[sudo] password for ben:
01/04/2022 08:24:57.318753 zmfilter_12[14465].INF [main:159] [Scanning for events using filter id '12']
Use of uninitialized value in subtraction (-) at /usr/bin/zmfilter.pl line 187.
01/04/2022 08:24:57.626593 zmfilter_12[14465].INF [main:1040] [Executing 'python3 /home/ben/siddbot/siddbot.py /var/cache/zoneminder/events/4/2021-12-31/554535']
Traceback (most recent call last):
File "/home/ben/siddbot/siddbot.py", line 4, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
01/04/2022 08:24:58.916308 zmfilter_12[14465].ERR [main:1048] [Command 'python3 /home/ben/siddbot/siddbot.py /var/cache/zoneminder/events/4/2021-12-31/554535' exited with status: 1]
ben@ben-P-7805u:~/siddbot$
--------------------------------------------------------------------------------------
If im reading this right user www-data doesnt have the discord package, i must have installed it local to the user id i used to write the script. I'm going to tinker and will post back when i get the package installed correctly.
Thanks again,
--------------------------------------------------------------------------------------
ben@ben-P-7805u:~/siddbot$ sudo -u www-data zmfilter.pl --filter_id=12
[sudo] password for ben:
01/04/2022 08:24:57.318753 zmfilter_12[14465].INF [main:159] [Scanning for events using filter id '12']
Use of uninitialized value in subtraction (-) at /usr/bin/zmfilter.pl line 187.
01/04/2022 08:24:57.626593 zmfilter_12[14465].INF [main:1040] [Executing 'python3 /home/ben/siddbot/siddbot.py /var/cache/zoneminder/events/4/2021-12-31/554535']
Traceback (most recent call last):
File "/home/ben/siddbot/siddbot.py", line 4, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
01/04/2022 08:24:58.916308 zmfilter_12[14465].ERR [main:1048] [Command 'python3 /home/ben/siddbot/siddbot.py /var/cache/zoneminder/events/4/2021-12-31/554535' exited with status: 1]
ben@ben-P-7805u:~/siddbot$
--------------------------------------------------------------------------------------
If im reading this right user www-data doesnt have the discord package, i must have installed it local to the user id i used to write the script. I'm going to tinker and will post back when i get the package installed correctly.
Thanks again,
Re: Custom Script failing on execute only
So i figured out what i did wrong, I was following a tutorial to get the discord bot set up and installed it using
$ pip install -U discord.py
to fix my mistakes i uninstalled using the following:
$ pip3 uninstall discord.py
$ sudo pip3 install discord.py
then for some reason i needed to reinstall aiohttp as well:
$ sudo -H pip3 install aiohttp
and now all is well.
Thanks again,
$ pip install -U discord.py
to fix my mistakes i uninstalled using the following:
$ pip3 uninstall discord.py
$ sudo pip3 install discord.py
then for some reason i needed to reinstall aiohttp as well:
$ sudo -H pip3 install aiohttp
and now all is well.
Thanks again,