Show More
@@ -342,26 +342,7 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
342 | return |
|
342 | return | |
343 |
|
343 | |||
344 | import win_unicode_console |
|
344 | import win_unicode_console | |
345 |
|
||||
346 | if PY3: |
|
|||
347 |
|
|
345 | win_unicode_console.enable() | |
348 | else: |
|
|||
349 | # https://github.com/ipython/ipython/issues/9768 |
|
|||
350 | from win_unicode_console.streams import (TextStreamWrapper, |
|
|||
351 | stdout_text_transcoded, stderr_text_transcoded) |
|
|||
352 |
|
||||
353 | class LenientStrStreamWrapper(TextStreamWrapper): |
|
|||
354 | def write(self, s): |
|
|||
355 | if isinstance(s, bytes): |
|
|||
356 | s = s.decode(self.encoding, 'replace') |
|
|||
357 |
|
||||
358 | self.base.write(s) |
|
|||
359 |
|
||||
360 | stdout_text_str = LenientStrStreamWrapper(stdout_text_transcoded) |
|
|||
361 | stderr_text_str = LenientStrStreamWrapper(stderr_text_transcoded) |
|
|||
362 |
|
||||
363 | win_unicode_console.enable(stdout=stdout_text_str, |
|
|||
364 | stderr=stderr_text_str) |
|
|||
365 |
|
346 | |||
366 | def init_io(self): |
|
347 | def init_io(self): | |
367 | if sys.platform not in {'win32', 'cli'}: |
|
348 | if sys.platform not in {'win32', 'cli'}: |
General Comments 0
You need to be logged in to leave comments.
Login now