[elbe-devel] [PATCH] soapclient: Handle logged utf-16 characters in wait_busy action

andreas at linutronix.de andreas at linutronix.de
Tue Apr 30 09:45:18 CEST 2019


From: Andreas Messerschmid <andreas.messerschmid at linutronix.de>

Convert logging output to utf-8 before printing and let the
python libraries do the replacing of all the newline/carriage return
variants, so we can omit failures like:

| Mon Apr 29 11:18:04 2019 -- Adding debian:IdenTrust_Commercial_Root_CA_1.pem
| Traceback (most recent call last):
|   File "/home/andreas/elbe/elbe", line 55, in <module>
|     cmdmod.run_command(sys.argv[2:])
|   File "/home/andreas/elbe/elbepack/commands/control.py", line 169, in run_command
|     action.execute(control, opt, args[1:])
|   File "/home/andreas/elbe/elbepack/soapclient.py", line 617, in execute
|     log[1].replace('\n','')))
| UnicodeEncodeError: 'ascii' codec can't encode character u'\u0151' in position 70:
|                     ordinal not in range(128)
| elbe control wait_busy Failed
| Giving up

Signed-off-by: Andreas Messerschmid <andreas.messerschmid at linutronix.de>
---
 elbepack/soapclient.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index 6ae1bd2..1de3e64 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -614,7 +614,7 @@ class WaitProjectBusyAction(ClientAction):
                         localtime = time.asctime(time.localtime(time.time()))
                         try:
                             print("%s -- %s" % (localtime,
-                                                log[1].replace('\n','')))
+                                                ''.join(log[1].splitlines()).encode('utf-8')))
                         except IndexError:
                             print("IndexError - part: %d (skipped)" % part)
                     else:
-- 
2.11.0




More information about the elbe-devel mailing list