Project

General

Profile

« Previous | Next » 

Revision 2883

Wrap sys.stderr.write() calls in strings.to_raw_str() to avoid UnicodeEncodeErrors when stderr is to a file and the default encoding is ASCII

View differences:

lib/exc.py
78 78
    if emph:
79 79
        first_line, nl, rest = msg.partition('\n')
80 80
        msg = term.error(first_line)+nl+rest
81
    sys.stderr.write(msg)
81
    sys.stderr.write(strings.to_raw_str(msg))
82 82

  
83 83
class ExTracker:
84 84
    def __init__(self):
bin/map
120 120
                    first_line, nl, msg = msg.partition('\n')
121 121
            elif level > 1: msg = '['+str(level)+'] '+msg # include level in msg
122 122
            
123
            sys.stderr.write(msg.rstrip('\n')+'\n')
123
            sys.stderr.write(strings.to_raw_str(msg.rstrip('\n')+'\n'))
124 124
    if debug: log_debug = lambda msg, level=2: log(msg, level)
125 125
    else: log_debug = sql.log_debug_none
126 126
    

Also available in: Unified diff