You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a conflict between rich.progress.Progress and click.echo().
The rich.progress.Progress context manager monkey-patches sys.stdout. click.echo() detects whether sys.stdout is a text stream or byte stream (this is questionable, but it is a different issue) by trying to write an empty bytes object. If the test is passed successfully, then it is a bytes stream, and click encodes string before writing it. But the wrapper instantiated by Progress ignores empty input for write(), including empty bytes object, therefore click.echo() concludes that it is a byte stream.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../site-packages/click/utils.py", line 272, in echo
file.write(message)
File ".../site-packages/rich/progress.py", line 491, in write
line, new_line, text = text.partition("\n")
TypeError: a bytes-like object is required, not 'str'
It is not completely a failure of rich, but it would be better if the wrapper better emulate output text stream. In particularly check that the argument of write() is string.
rich 9.3.0
The text was updated successfully, but these errors were encountered:
There is a conflict between
rich.progress.Progress
andclick.echo()
.The
rich.progress.Progress
context manager monkey-patchessys.stdout
.click.echo()
detects whethersys.stdout
is a text stream or byte stream (this is questionable, but it is a different issue) by trying to write an empty bytes object. If the test is passed successfully, then it is a bytes stream, and click encodes string before writing it. But the wrapper instantiated by Progress ignores empty input forwrite()
, including empty bytes object, thereforeclick.echo()
concludes that it is a byte stream.Example:
Traceback:
It is not completely a failure of rich, but it would be better if the wrapper better emulate output text stream. In particularly check that the argument of
write()
is string.rich 9.3.0
The text was updated successfully, but these errors were encountered: