Page 1 of 1

Python under domoticz

Posted: Monday 06 April 2020 18:17
by Fatel
Hi all,

I am trying to run a python script from domoticz.
In this script there is a command

import requests

When running the script is get messages in the log like
2020-04-05 13:42:40.249 Error: EventSystem: Failed to execute python event script "testjb"
2020-04-05 13:42:40.250 Error: EventSystem: Traceback (most recent call last):
2020-04-05 13:42:40.250 Error: EventSystem: File "<string>", line 4, in <module>
2020-04-05 13:42:40.250 Error: EventSystem: ModuleNotFoundError: No module named 'requests'
EventSytem: ModuleNotFoundError: No module named ‘requests’

This is the example of code. Does nothing just to try the import requests

Code: Select all

#!/usr/bin/python3 
import subprocess
import time
import requests

def apc_probe() :
    response = requests.get('https://api.github.com')
    print (response.content)
    time.sleep(10)

apc_probe()
When i start python or python3 from commandline then the import is ok. I tried this for current user and with sudo.

Pip install requests
And
Pip3 install requests both say installed.


Any1 got an idea how to solve it? Or is python from domoticz being run by another account?

Running on buster, version 2020.1 stable