splunk-sdk-python
splunk-sdk-python copied to clipboard
Empty text node raises 'NoneType' object has no attribute 'encode'
In splunklib/results.py at line 257 values.append(elem.text.encode('utf8')) can raise an AttributeError for encode.
If the xml looks like:
<field k='named_field'>
<value><text></text></value>
</field>
elem.text will be the None object, not an empty string as one might expect. I've used this instead:
t = elem.text
if not t:
t = ''
values.append(t.encode('utf8'))
champ fix. thanks for this
Great @aarcro. Can you send us a pull request?