I am looking for a bit of help with an error please and thanks,
The code below is just a portion to show where I am running into a problem. def startup(self) will open the url fine, def update(self) gives an error like so;
File "plugin.py", line 157, in update
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/socket.py", line 304, in read
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py", line 529, in read
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/socket.py", line 328, in read
<class 'socket.error'>: (54, 'Connection reset by peer')
I tried to comment out the def startup(self) block of code and I still get the error. If the url is being called with the same code in each method, why is it failing in the update(self) method yet works in the startup(self) method?
- Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import serial, time, os, decimal, csv, urllib2, socket
import xml.etree.cElementTree as ET
from xml.etree.cElementTree import parse
class Plugin(indigo.PluginBase):
owd= '{http://schema/owserver}owd_DS18B20'
h = '{http:///schema/owserver}Health'
socket.setdefaulttimeout(60)
url = "http://169.254.1.1/details.xml"
f= urllib2.urlopen(url)
def startup(self):
for x in parse(self.f).findall(Plugin.owd):
dataA = x.find(Plugin.id)
def update(self):
for x in parse(self.f).findall(Plugin.owd):
dataB = x.find(Plugin.h)
Thank you,
Jeff