<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Good Afternoon,<br><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Among other elements values that my script finds is value for sepid<br>
<br>sepid = content.find(".//{<a href="http://www.huawei.com.cn/schema/common/v2_1}sepid">http://www.huawei.com.cn/schema/common/v2_1}sepid</a>").text<br><br><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">
however, if i pass xml data that DOES NOT contain sepid element, i get an error:<br><br>Traceback (most recent call last):<br> File "/usr/local/bin/receive.py", line 21, in <module><br> sepid = content.find(".//{<a href="http://www.huawei.com.cn/schema/common/v2_1}sepid">http://www.huawei.com.cn/schema/common/v2_1}sepid</a>").text<br>
AttributeError: 'NoneType' object has no attribute 'text'<br><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">
some messages i receive will have the sepid parameter, other will not have this parameter. How can i cater for this? kinda like an if .. else implementation for xml.etree.ElementTree ?<br><br><br><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">
Thanks in advance.<br><br></div><div><div dir="ltr"><font size="4"><span style="font-family:georgia,serif">Saludos<br><br>Ombongi Moraa Faith</span></font><br></div></div>
</div>