import "random" problem
Posted: Saturday 18 January 2020 20:24
Hello,
I just update to the last beta version (I didn't do update since 2 months)
Since, I have 2 plugins doesn't work:
- Zigate
- Broadlink
Both plugins import "random" from the plugin
With @pipiche, we was create a simple plugin with the import "random" and we have the same problem.
Version :
DomoticzVersion: 4.11609
DomoticzBuildTime: 2020-01-13 19:44:14
Python 3.5.3
Log :
The basic script :
Regards
I just update to the last beta version (I didn't do update since 2 months)
Since, I have 2 plugins doesn't work:
- Zigate
- Broadlink
Both plugins import "random" from the plugin
With @pipiche, we was create a simple plugin with the import "random" and we have the same problem.
Version :
DomoticzVersion: 4.11609
DomoticzBuildTime: 2020-01-13 19:44:14
Python 3.5.3
Log :
Code: Select all
2020-01-17 17:12:27.986 Status: (Basic) Started.
Fatal Python error: Segmentation fault
Thread 0x00007f7db9240700 (most recent call first):
File "<frozen importlib.bootstrap>", line 222 in call_with_frames_removed
File "<frozen importlib.bootstrapexternal>", line 914 in create_module
File "<frozen importlib.bootstrap>", line 577 in modulefrom_spec
File "<frozen importlib.bootstrap>", line 666 in load_unlocked
File "<frozen importlib.bootstrap>", line 958 in find_and_load_unlocked
File "<frozen importlib.bootstrap>", line 969 in find_and_load
File "/usr/lib/python3.5/hashlib.py", line 132 in <module>
File "<frozen importlib.bootstrap>", line 222 in call_with_frames_removed
File "<frozen importlib.bootstrapexternal>", line 673 in exec_module
File "<frozen importlib.bootstrap>", line 673 in load_unlocked
File "<frozen importlib.bootstrap>", line 958 in find_and_load_unlocked
File "<frozen importlib.bootstrap>", line 969 in find_and_load
File "/usr/lib/python3.5/random.py", line 45 in <module>
File "<frozen importlib.bootstrap>", line 222 in call_with_frames_removed
File "<frozen importlib.bootstrapexternal>", line 673 in exec_module
File "<frozen importlib.bootstrap>", line 673 in load_unlocked
File "<frozen importlib.bootstrap>", line 958 in find_and_load_unlocked
File "<frozen importlib.bootstrap>", line 969 in find_and_load
File "/opt/domoticz/plugins/Random/plugin.py", line 27 in <module>
File "<frozen importlib.bootstrap>", line 222 in call_with_frames_removed
File "<frozen importlib.bootstrapexternal>", line 673 in exec_module
File "<frozen importlib.bootstrap>", line 673 in load_unlocked
File "<frozen importlib.bootstrap>", line 958 in find_and_load_unlocked
File "<frozen importlib.bootstrap>", line 969 in find_and_load
Code: Select all
# Basic Python Plugin Example
#
# Author: GizMoCuz
#
"""
<plugin key="BasePlug" name="Basic Python Plugin Example" author="gizmocuz" version="1.0.0" wikilink="http://www.domoticz.com/wiki/plugins/plugin.html" externallink="https://www.google.com/">
<description>
<h2>Plugin Title</h2><br/>
Overview...
<h3>Features</h3>
<ul style="list-style-type:square">
<li>Feature one...</li>
<li>Feature two...</li>
</ul>
<h3>Devices</h3>
<ul style="list-style-type:square">
<li>Device Type - What it does...</li>
</ul>
<h3>Configuration</h3>
Configuration options...
</description>
<params>
</params>
</plugin>
"""
import Domoticz
import random
class BasePlugin:
enabled = False
def __init__(self):
#self.var = 123
return
def onStart(self):
Domoticz.Log("onStart called")
def onStop(self):
Domoticz.Log("onStop called")
def onConnect(self, Connection, Status, Description):
Domoticz.Log("onConnect called")
def onMessage(self, Connection, Data):
Domoticz.Log("onMessage called")
def onCommand(self, Unit, Command, Level, Hue):
Domoticz.Log("onCommand called for Unit " + str(Unit) + ": Parameter '" + str(Command) + "', Level: " + str(Level))
def onNotification(self, Name, Subject, Text, Status, Priority, Sound, ImageFile):
Domoticz.Log("Notification: " + Name + "," + Subject + "," + Text + "," + Status + "," + str(Priority) + "," + Sound + "," + ImageFile)
def onDisconnect(self, Connection):
Domoticz.Log("onDisconnect called")
def onHeartbeat(self):
Domoticz.Log("onHeartbeat called")
global _plugin
_plugin = BasePlugin()
def onStart():
global _plugin
_plugin.onStart()
def onStop():
global _plugin
_plugin.onStop()
def onConnect(Connection, Status, Description):
global _plugin
_plugin.onConnect(Connection, Status, Description)
def onMessage(Connection, Data):
global _plugin
_plugin.onMessage(Connection, Data)
def onCommand(Unit, Command, Level, Hue):
global _plugin
_plugin.onCommand(Unit, Command, Level, Hue)
def onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile):
global _plugin
_plugin.onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile)
def onDisconnect(Connection):
global _plugin
_plugin.onDisconnect(Connection)
def onHeartbeat():
global _plugin
_plugin.onHeartbeat()
# Generic helper functions
def DumpConfigToLog():
for x in Parameters:
if Parameters[x] != "":
Domoticz.Debug( "'" + x + "':'" + str(Parameters[x]) + "'")
Domoticz.Debug("Device count: " + str(len(Devices)))
for x in Devices:
Domoticz.Debug("Device: " + str(x) + " - " + str(Devices[x]))
Domoticz.Debug("Device ID: '" + str(Devices[x].ID) + "'")
Domoticz.Debug("Device Name: '" + Devices[x].Name + "'")
Domoticz.Debug("Device nValue: " + str(Devices[x].nValue))
Domoticz.Debug("Device sValue: '" + Devices[x].sValue + "'")
Domoticz.Debug("Device LastLevel: " + str(Devices[x].LastLevel))
return