Python under domoticz

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Fatel
Posts: 1
Joined: Sunday 01 March 2020 19:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python under domoticz

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest