Closed chinmay2197 closed 3 years ago
Thanks for the bug report @chinmay2197, we're open to a PR but currently preparing for .conf and don't have the bandwidth to investigate this further.
I have the same error in write_xml_document method of event_writer.py file.
It seems to work changing self._out.write(ET.tostring(document)) to self._out.write(ET.tostring(document, encoding='unicode')) in event_writer.py file
You can also use this change (works for me):
self._out.write(ET.tostring(document))
to self._out.write(ET.tostring(document).decode())
Same for me. The write() function in python3 expects str
and not bytes
. And when I want to write and event to Splunk it just throws TypeError.
Are there any clues on when this may be fixed?
Related to #271
Latest release of python sdk supports Python3 along with Python2, so we would request you to use the latest version of python sdk
In the latest version, before writing the encoded XML document to stream, it is encoded through "ensure_str()" which handles the decoding of bytes before encoding the xml document while using Python3
Do let us know if the issue is resolved .
Python
sys.stdout.write()
does not supporting writing bytes to stdout stream In event_writer.pyself._out.write(b"<stream>")
at line 54 andself._out.write(b"</stream>")
at line 81 In event_writer.pywrite_xml_document
method try to write encoded xml document to stream withself._out.write(ET.tostring(document))
In event.pyself._out.write(ET.tostring(document))
inwrite_to
methodThis causes ERROR in modular input ingesting event like below:
TypeError: write() argument must be str, not bytes