Я был diggin 'и diggin' около 2 часов, но я не смог найти причину этой ошибки:
1) JBoss
2) Tomcat
Select an application: 1
<App id="1" type="JBoss" path="" state="ok"/>
Traceback (most recent call last):
File "/root/RService.py", line 47, in <module>
Stats = app.getAttribute('state')
AttributeError: 'lxml.etree._Element' object has no attribute 'getAttribute'
И часть моего кода:
app_types = set(nXML.xpath('//Group[@id=$gList]//descendant::App/@type',gList=gList))
app_dict = dict((x+1,y) for (x,y) in enumerate(app_types))
print "\n".join("%d) %s" % x for x in sorted(app_dict.items()))
app_selection = input("Select an application: ")
app_type = app_dict.get(int(app_selection))
for app in nXML.xpath('//Group[@id=$gList]//App[@type=$app_type]',gList=gList,app_type=app_type):
print etree.tostring(app)
Stats = app.getAttribute('state')
stype = app.getAttribute('type')
trigger = 0
while trigger < 1:
if Stats == 'ok':
try: ... ...
Это работало раньше, что случилось с синтаксисом?
Спасибо