builtins: self.outf.write vs trace.note

Martin Pool mbp at canonical.com
Mon Nov 16 05:49:52 GMT 2009


2009/11/14 Gordon Tyler <gordon at doxxx.net>:
> I've pushed the remaining changes up to lp:~doxxx/bzr/output-cleanup
> (https://code.edge.launchpad.net/~doxxx/bzr/output-cleanup). I've fixed all
> the tests that were broken by my changes except one which I can't figure
> out:

Thanks.

On the weekend I wrote some code that removes logging and unifies
Command.outf with the UIFactory so it should help with some of these
problems.

>
> test_non_ascii is failing in test_mkdir with a very odd error message from
> the Python logging module.
>
> 10.680  run bzr: ['mkdir', u'r\xe4ksm\xf6rg\xe5s2']
> 10.680  bzr arguments: ['mkdir', u'r\xe4ksm\xf6rg\xe5s2']
> 10.681  encoding stdout as sys.stdout encoding 'ascii'
> 10.686  opening working tree
> 'C:/users/owner/appdata/local/temp/testbzr-hfk35k.tmp/onAscii.test_mkdir(iso_8859_1)/work'
>    INFO  added rA☼ksmA¶rgA¥s2
> 10.698  errors:
> 'Traceback (most recent call last):\n  File
> "C:\\Python26\\lib\\logging\\__init__.py", line 791, in emit\n
> stream.write(fs % msg.encode("UTF-8"))\nUnicodeDecodeError: \'ascii\' codec
> can\'t decode byte 0xc3 in position 7: ordinal not in range(128)\n'
>
> In other words, the invoked bzr command is failing with a UnicodeDecodeError
> like so:
>
> Traceback (most recent call last):
>  File "C:\\Python26\\lib\\logging\\__init__.py", line 791, in emit
>    stream.write(fs % msg.encode("UTF-8"))
> UnicodeDecodeError: \'ascii\' codec can\'t decode byte 0xc3 in position 7:
> ordinal not in range(128)

I saw some like these too, and they were typically to do with files
not having an encoding wrapper when they should.

Since the code you're calling into is changing I probably wouldn't
worry about the failure until someone reviews your branch.  Thanks for
trying it though.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list