potiuk commented on PR #56871:
URL: https://github.com/apache/airflow/pull/56871#issuecomment-3421126354

   That's a good question: 
   
   @ashb -> is there a particular reason why "buffer" was used in this case? It 
is supposed to take bytes not strings and the documentation indeed warns that 
if you have no control over stdout it can be replaced with file-like interface 
(which is exactly what Pydevd does).
   
   See https://docs.python.org/3/library/sys.html#sys.stdout
   
   > Note To write or read binary data from/to the standard streams, use the 
underlying binary 
[buffer](https://docs.python.org/3/library/io.html#io.TextIOBase.buffer) 
object. For example, to write bytes to 
[stdout](https://docs.python.org/3/library/sys.html#sys.stdout), use 
sys.stdout.buffer.write(b'abc').
   However, if you are writing a library (and do not control in which context 
its code will be executed), be aware that the standard streams may be replaced 
with file-like objects like 
[io.StringIO](https://docs.python.org/3/library/io.html#io.StringIO) which do 
not support the buffer attribute.
   
   Is it really that we have some binary non-encoded data sent there ? 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to