builtins: self.outf.write vs trace.note

Gordon Tyler gordon at doxxx.net
Mon Nov 16 14:39:32 GMT 2009


> 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.

So the trace module is gone?

>> 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.

I worked around it by changing StringIOWrapper to encode() Unicode 
strings to the stream's encoding with the 'replace' option, which allows 
encodings like 'ascii' to handle weird character without throwing 
exceptions.

It seemed like a bit of a skanky hack though, so I haven't published it. 
And seeing as how you're changing a lot of the infrastructure around it, 
I should wait and see if it fixes itself?

> 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.

Are there changes on trunk that I should be merging into my branch? 
Should I continue with my branch or is it obsolete now?

Thanks,
Gordon




More information about the bazaar mailing list