Skip to content

Commit 8df401b

Browse files
committed
Handle UnicodeEncodeErrors when printing emotes
1 parent 1e8f603 commit 8df401b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/manage/logging.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ def __exit__(self, *exc_info):
218218
if self._complete:
219219
LOGGER.print()
220220
else:
221-
LOGGER.print("❌")
221+
try:
222+
LOGGER.print("❌")
223+
except UnicodeEncodeError:
224+
LOGGER.print("x")
222225

223226
def __call__(self, progress):
224227
if self._complete:
@@ -227,7 +230,10 @@ def __call__(self, progress):
227230
if progress is None:
228231
if self._need_newline:
229232
if not self._complete:
230-
LOGGER.print("⏸️")
233+
try:
234+
LOGGER.print("⏸️")
235+
except UnicodeEncodeError:
236+
LOGGER.print("|")
231237
self._dots_shown = 0
232238
self._started = False
233239
self._need_newline = False
@@ -246,6 +252,9 @@ def __call__(self, progress):
246252
LOGGER.print(None, "." * dot_count, end="", flush=True)
247253
self._need_newline = True
248254
if progress >= 100:
249-
LOGGER.print("✅", flush=True)
255+
try:
256+
LOGGER.print("✅", flush=True)
257+
except UnicodeEncodeError:
258+
LOGGER.print(".", flush=True)
250259
self._complete = True
251260
self._need_newline = False

0 commit comments

Comments
 (0)