for x in item.getchildren():
if x.tag == "description":
text = x.text
- text = text.replace(
- "<strong>Stevens Pass US2</strong><br/>", ""
- )
- text = text.replace("<br/><br/>", "<BR>")
- text = text.replace(
- "<strong>Elevation Meters:</strong>1238<BR>", ""
- )
- f.write("<P>\n%s\n" % text)
+ if text is not None:
+ text = text.replace(
+ "<strong>Stevens Pass US2</strong><br/>", ""
+ )
+ text = text.replace("<br/><br/>", "<BR>")
+ text = text.replace(
+ "<strong>Elevation Meters:</strong>1238<BR>", ""
+ )
+ else:
+ text = ""
+ f.write(f"<P>\n{text}\n")
return True
return False