====================== Sunday, March 15, 2015 ====================== Redirecting non-ascii stdout to a file ====================================== :manage:`repairdata` now supports positional arguments: if arguments are specified, then they are expected to be full names of the models to be tested. I got UnicodeEncodeError when I wanted to redirect the output of :manage:`repairdata` to a file. For example, in :mod:`lino.projects.min2` the following command gives quite some output, including Non-ASCII text:: $ python manage.py repairdata And it works, at least if the :envvar:`LANG` is correctly set. But redirecting that output to a file does not work:: $ python manage.py repairdata > tmp.txt And after having read posts like `this one `__, I added the following line to :mod:`atelier`:: import sys, codecs, locale sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) That is: importing :mod:`atelier` now automatically adds a codecs writer to `sys.stdout`. I then discovered that as a consequence, :mod:`atelier.doctest_utf8` is no longer needed. Result is that I can now do the above redirection. And everything else seems to work.