Hat jemand eine Idee, wie dies hier zustande kommt:
das läuft einwandfrei unter smarthome.py ( mit Python 2.7 ). aber bringt diese Fehler mit SmartHomeNG
ich schätze aber, das ist ein Python 3.5 Problem
ich greife einfach via HTTP auf einen Server zu und hole dort Daten ab:
Code:
2017-06-06 12:47:29 INFO hello Hello World!
2017-06-06 12:50:34 ERROR Pool2 Logic: Pool2, File: /usr/local/lib/python3.5/http/client.py, Line: 266, Method: _read_status, Exception: Remote end closed connection without response
Traceback (most recent call last):
File "/usr/local/smarthome/lib/scheduler.py", line 378, in _task
exec(obj.bytecode)
File "/usr/local/smarthome/logics/OSF2.py", line 3, in <module>
req = urllib.request.urlopen("http://PC40-1/stathei.htm")
File "/usr/local/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/local/lib/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/local/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.5/urllib/request.py", line 1282, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/lib/python3.5/urllib/request.py", line 1257, in do_open
r = h.getresponse()
File "/usr/local/lib/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/local/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.5/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
2017-06-06 12:50:45 INFO CP Server Thread-8 192.168.178.21 - - [06/Jun/2017:12:50:45] "GET / HTTP/1.1" 401 1502 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0"
2017-06-06 12:52:09 INFO CP Server Thread-9 192.168.178.21 - - [06/Jun/2017:12:52:09] "GET / HTTP/1.1" 401 1502 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0)
ich schätze aber, das ist ein Python 3.5 Problem
ich greife einfach via HTTP auf einen Server zu und hole dort Daten ab:
Code:
# OSF2
import urllib.request
req = urllib.request.urlopen("http://PC40-1/stathei.htm")
data = req.read().decode('UTF-8')
sh.Pool.Status.Heizung(data)
words = data.split()
if words[-1] == 'an':
sh.Pool.Status.Solar("true")
else:
sh.Pool.Status.Solar("false")
#


einwandfrei funktioniert.
Kommentar