Thanks John - no success yet, see below ...

On 23/09/2015 5:38 AM, John La Rooy wrote:

On Tue, Sep 22, 2015 at 7:51 PM, Mike Dewhirst <[email protected]
<mailto:[email protected]>> wrote:

    File "C:\Users\mike\env\xxex3\lib\encodings\cp1252.py", line 19, in
    encode
    Â  Â  return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode character '\u2083'
    in position 293: character maps to <undefined>


This is telling you that there is no representation for '\u2083' in the
CP1252 encoding.
You'll need to tell the logging to open the file with a unicode codec
(eg utf-8).

I'm using the dict logging config approach because that is what works for Django out of the box. Here is an excerpt from my config:

logfile = "my_logfile".encode(encoding='utf_8', errors='strict')

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'formatter': 'default',
            'filename': logfile,
        },

The errors appear on the console and not in the log file. Obviously.

Maybe I should try the Django list?

Any other ideas?

Thanks again

Mike


Make sure the program you are viewing the log file with also knows it's
utf-8

Cheers,
John La Rooy


_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug


_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to