diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-04 18:26:27 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-04 18:26:27 +0000 |
commit | fad324877f76279dcd9efa5dac07bc97841329b1 (patch) | |
tree | 8a79b0700bd6e0f6856868586af224af21ead7dc | |
parent | dfd2101969942f3a48c995e78c15ee69c4600ecd (diff) | |
download | portage-fad324877f76279dcd9efa5dac07bc97841329b1.tar.gz portage-fad324877f76279dcd9efa5dac07bc97841329b1.tar.bz2 portage-fad324877f76279dcd9efa5dac07bc97841329b1.zip |
Open log files in text mode (to avoid UnicodeEncodeError). Thanks to Markos
Chandras <hwoarang@gentoo.org> for reporting.
svn path=/main/trunk/; revision=13901
-rw-r--r-- | pym/_emerge/Scheduler.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 9228ab6f4..0ad91675f 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -2,6 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +import codecs import logging import os import sys @@ -476,7 +477,8 @@ class Scheduler(PollScheduler): return self._pkg(cpv, type_name, root_config, installed=installed) def _append_to_log_path(self, log_path, msg): - f = open(log_path, 'a') + f = codecs.open(log_path, mode='a', + encoding='utf_8', errors='replace') try: f.write(msg) finally: @@ -490,7 +492,8 @@ class Scheduler(PollScheduler): background = self._background if background and log_path is not None: - log_file = open(log_path, 'a') + log_file = codecs.open(log_path, mode='a', + encoding='utf_8', errors='replace') out = log_file try: @@ -865,7 +868,8 @@ class Scheduler(PollScheduler): log_path = self._locate_failure_log(failed_pkg) if log_path is not None: try: - log_file = open(log_path) + log_file = codecs.open(log_path, mode='r', + encoding='utf_8', errors='replace') except IOError: pass |