Python template script error

Python and python framework

Moderator: leecollings

Post Reply
domoluk
Posts: 1
Joined: Sunday 27 September 2020 11:39
Target OS: Linux
Domoticz version:
Contact:

Python template script error

Post by domoluk »

Hi,

Using Domoticz Version 2020.2 (April 26th 2020), I have an error when trying to use the template script in Setup > More > Events > + > Python.
Reducing the script to its simplest expression:

myPythonScript :

Code: Select all

import domoticz
domoticz.log("Hi Domoticz!")
I still have the same error:

2020-09-27 11:50:00.159 Error: Pyhton Event System: Failed to parse parameters: string expected.
2020-09-27 11:50:00.159 Error: EventSystem: Failed to execute python event script "myPythonScript"
2020-09-27 11:50:00.159 Error: EventSystem: TypeError: function takes exactly 1 argument (2 given)
2020-09-27 11:50:00.159 Error: EventSystem:
2020-09-27 11:50:00.159 Error: EventSystem: The above exception was the direct cause of the following exception:
2020-09-27 11:50:00.159 Error: EventSystem:
2020-09-27 11:50:00.159 Error: EventSystem: Traceback (most recent call last):
2020-09-27 11:50:00.159 Error: EventSystem: File "<string>", line 3, in <module>
2020-09-27 11:50:00.159 Error: EventSystem: File "/home/domoticz/domoticz/scripts/python/domoticz.py", line 42, in log
2020-09-27 11:50:00.159 Error: EventSystem: domoticz_.Log(0, " ".join([str(k) for k in args]))
2020-09-27 11:50:00.159 Error: EventSystem: SystemError: <built-in function Log> returned a result with an error set
2020-09-27 11:50:00.161 Error: Pyhton Event System: Failed to parse parameters: string expected.

Python is correctly installed:
$ python --version
Python 3.7.3

domoticz.py line 42 is doing a domoticz_.Log(...), where domoticz_ is the import DomoticzEvents.
Seems an initialization issue, any idea ?

Thanks
lucasub
Posts: 15
Joined: Monday 28 March 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python template script error

Post by lucasub »

Use:

import DomoticzEvents as DE

DE.Log("bla bla bla")

Bye
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest