Wednesday, June 17, 2015¶
While looking for the explanation of a local problem in Eupen I made a
few optimizations about what to log into the
file. Or more precisely what to not log there: I converted some
calls to logger.info into calls to clint.textual.puts.
This revealed the problem that clint does not seem to like unicode strings. Here is a simple example:
# -*- coding: UTF-8 -*- from clint.textui import puts puts(u"Ein Blumensträußchen")
According to the unicode.py example this should work. But at least on my machine (with the latest released clint, version 0.4.1) it causes the following traceback:
Traceback (most recent call last): File "0617a.py", line 3, in <module> puts(u"Ein Blumensträußchen") File "/home/luc/pythonenvs/py27/local/lib/python2.7/site-packages/clint/textui/core.py", line 58, in puts s = map(str, s) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 13: ordinal not in range(128)
Aha, I am not the first one to stumble over it: https://github.com/kennethreitz/clint/issues/48
Added new function
lino.utils.puts()which currently just prints the string to stdout using
lino.core.kernel.Kernel.kernel_startup()we had the line:
I first replaced it by:
But then decided to even remove it completely. Because I cannot remember a single case where it has been actually useful that this message appears automatically at the console. At least in order to observe.