EventWriter is writing bytes on stdout which is not supported in python3
See original GitHub issuePython sys.stdout.write()
does not supporting writing bytes to stdout stream
In event_writer.py self._out.write(b"<stream>")
at line 54 and self._out.write(b"</stream>")
at line 81
In event_writer.py write_xml_document
method try to write encoded xml document to stream with self._out.write(ET.tostring(document))
In event.py self._out.write(ET.tostring(document))
in write_to
method
This causes ERROR in modular input ingesting event like below:
TypeError: write() argument must be str, not bytes
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Python 3 TypeError: must be str, not bytes with sys.stdout.write()
In your specific piece of code, nextline is of type bytes , not str , reading stdout and stdin from subprocess changed in...
Read more >Issue 18512: sys.stdout.write does not allow bytes in Python 3.x
and writing to stdout were OK in Python2, which makes porting programs harder. A workaround is to perform sys. stdout. flush() before sys....
Read more >A primer on the str and bytes types in Python 3 - arp242.net
In your specific piece of code, nextline is of type bytes , not str , reading stdout and stdin from subprocess changed in...
Read more >Python - Write Bytes to File - GeeksforGeeks
Next, use the write function to write the byte contents to a binary file. Python3. Python3 ...
Read more >[reportlab-users] Writing to stdout - Google Groups
I'm trying to write to stdout and it's not working. I'm using Python 3.8.6 with a clean virtualenv ... TypeError: write() argument must...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can also use this change (works for me):
self._out.write(ET.tostring(document))
toself._out.write(ET.tostring(document).decode())
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 .