eric6/DebugClients/Python/AsyncFile.py

changeset 8243
cc717c2ae956
parent 8230
8b5c6896655b
child 8273
698ae46f40a4
--- a/eric6/DebugClients/Python/AsyncFile.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/DebugClients/Python/AsyncFile.py	Thu Apr 15 18:11:24 2021 +0200
@@ -10,6 +10,7 @@
 
 import socket
 import threading
+import contextlib
 
 from DebugUtilities import prepareJsonCommand
 
@@ -109,10 +110,9 @@
                 break
             
             try:
-                try:
+                with contextlib.suppress(UnicodeEncodeError,
+                                         UnicodeDecodeError):
                     buf = buf.encode('utf-8', 'backslashreplace')
-                except (UnicodeEncodeError, UnicodeDecodeError):
-                    pass
                 self.sock.sendall(buf)
                 self.nWriteErrors = 0
             except OSError:

eric ide

mercurial