101 def flush(self): |
101 def flush(self): |
102 """ |
102 """ |
103 Public method to write all pending entries. |
103 Public method to write all pending entries. |
104 """ |
104 """ |
105 while self.wpending: |
105 while self.wpending: |
106 buf = self.wpending.pop(0) |
106 try: |
|
107 buf = self.wpending.pop(0) |
|
108 except IndexError: |
|
109 break |
|
110 |
107 try: |
111 try: |
108 try: |
112 try: |
109 buf = buf.encode('utf-8', 'backslashreplace') |
113 buf = buf.encode('utf-8', 'backslashreplace') |
110 except (UnicodeEncodeError, UnicodeDecodeError): |
114 except (UnicodeEncodeError, UnicodeDecodeError): |
111 pass |
115 pass |