1 |
Author: zmedico |
2 |
Date: 2009-08-04 18:26:27 +0000 (Tue, 04 Aug 2009) |
3 |
New Revision: 13901 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/Scheduler.py |
7 |
Log: |
8 |
Open log files in text mode (to avoid UnicodeEncodeError). Thanks to Markos |
9 |
Chandras <hwoarang@g.o> for reporting. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/_emerge/Scheduler.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/_emerge/Scheduler.py 2009-08-04 18:09:46 UTC (rev 13900) |
15 |
+++ main/trunk/pym/_emerge/Scheduler.py 2009-08-04 18:26:27 UTC (rev 13901) |
16 |
@@ -2,6 +2,7 @@ |
17 |
# Distributed under the terms of the GNU General Public License v2 |
18 |
# $Id$ |
19 |
|
20 |
+import codecs |
21 |
import logging |
22 |
import os |
23 |
import sys |
24 |
@@ -476,7 +477,8 @@ |
25 |
return self._pkg(cpv, type_name, root_config, installed=installed) |
26 |
|
27 |
def _append_to_log_path(self, log_path, msg): |
28 |
- f = open(log_path, 'a') |
29 |
+ f = codecs.open(log_path, mode='a', |
30 |
+ encoding='utf_8', errors='replace') |
31 |
try: |
32 |
f.write(msg) |
33 |
finally: |
34 |
@@ -490,7 +492,8 @@ |
35 |
background = self._background |
36 |
|
37 |
if background and log_path is not None: |
38 |
- log_file = open(log_path, 'a') |
39 |
+ log_file = codecs.open(log_path, mode='a', |
40 |
+ encoding='utf_8', errors='replace') |
41 |
out = log_file |
42 |
|
43 |
try: |
44 |
@@ -865,7 +868,8 @@ |
45 |
log_path = self._locate_failure_log(failed_pkg) |
46 |
if log_path is not None: |
47 |
try: |
48 |
- log_file = open(log_path) |
49 |
+ log_file = codecs.open(log_path, mode='r', |
50 |
+ encoding='utf_8', errors='replace') |
51 |
except IOError: |
52 |
pass |