mondrian icon indicating copy to clipboard operation
mondrian copied to clipboard

STDOUT logging

Open ehsan9891 opened this issue 4 years ago • 2 comments

When I use bonobo in Airflow, sys.stdout will be StreamLogWriter and has no buffer attribute. There should be another check mondrian/init.py:23

if sys.stdout.encoding is None or sys.stdout.encoding == "ANSI_X3.4-1968": sys.stdout = codecs.getwriter("UTF-8")(sys.stdout.buffer, errors="replace") sys.stderr = codecs.getwriter("UTF-8")(sys.stderr.buffer, errors="replace")

To check if attribute buffer exist or it is normal stdout class.

sys.stdout = codecs.getwriter("UTF-8")(sys.stdout.buffer, errors="replace") AttributeError: 'StreamLogWriter' object has no attribute 'buffer'

ehsan9891 avatar Jun 15 '21 08:06 ehsan9891

I was not able to create PR

but that should be solution

if (sys.stdout.encoding is None or sys.stdout.encoding == "ANSI_X3.4-1968") and hasattr(sys.stdout, 'buffer'): sys.stdout = codecs.getwriter("UTF-8")(sys.stdout.buffer, errors="replace") sys.stderr = codecs.getwriter("UTF-8")(sys.stderr.buffer, errors="replace")

in mondrian/init.py:23

ehsan9891 avatar Jun 15 '21 09:06 ehsan9891

Hey @ehsan9891 look at my PR !18

jrmi avatar Oct 12 '21 13:10 jrmi