Matt,
For some reason I didn't get notification of your reply but anyway I a happy you found the problem.
I am trying to execute this script;
Code: Select all
import xml.etree.cElementTree as ET
#location of the file to be parsed
content = ET.ElementTree(file="/Users/abook/Desktop/tempalert.xml")
ports = content.find("ports")
#get all the port elements
for port in ports.findall('port'):
if port.get('name') == 'Port 1':
currentTemp = port.find("condition/currentReading")
#print currentTemp.text
indigo.variable.updateValue("tempAlert1_", currentTemp)
elif port.get('name') == 'Port 2':
currentTemp = port.find("condition/currentReading")
#print currentTemp.text
indigo.variable.updateValue("tempAlert2_", currentTemp)
But I get this error;
$ indigohost -x /Users/abook/Desktop/workingcopy.py
workingcopy.py: invalid syntax
around line 1 - "import xml.etree.cElementTree as ET"
But if I run this below it runs OK.
Code: Select all
import xml.etree.cElementTree as ET
#location of the file to be parsed
content = ET.ElementTree(file="/Users/abook/Desktop/tempalert.xml")
ports = content.find("ports")
#get all the port elements
for port in ports.findall('port'):
if port.get('name') == 'Port 1':
currentTemp = port.find("condition/currentReading")
print currentTemp.text
#indigo.variable.updateValue("tempAlert1_", currentTemp)
elif port.get('name') == 'Port 2':
currentTemp = port.find("condition/currentReading")
print currentTemp.text
#indigo.variable.updateValue("tempAlert2_", currentTemp)
Code: Select all
$ python /Users/abook/Desktop/workingcopy.py
73.2
950.2