Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/usethis/_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
from rich.table import Table

# Unicode support - but we need to be able to write bytes
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.buffer)
sys.stderr = codecs.getwriter("utf-8")(sys.stderr.buffer)
try:
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.buffer)
sys.stderr = codecs.getwriter("utf-8")(sys.stderr.buffer)
except AttributeError:
# e.g. in Jupyter
pass

console = Console()
err_console = Console(stderr=True)
Expand Down
Loading