diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-04 18:09:46 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-04 18:09:46 +0000 |
commit | dfd2101969942f3a48c995e78c15ee69c4600ecd (patch) | |
tree | 5dc4f931fb7a2e4a935e610ce1c28be252bc9440 | |
parent | 8f0d0b7590445f60149d578c5ac05e43f2b3b2d6 (diff) | |
download | portage-dfd2101969942f3a48c995e78c15ee69c4600ecd.tar.gz portage-dfd2101969942f3a48c995e78c15ee69c4600ecd.tar.bz2 portage-dfd2101969942f3a48c995e78c15ee69c4600ecd.zip |
Avoid UnicodeEncodeError in writemsg(). Thanks to Markos Chandras
<hwoarang@gentoo.org> for reporting.
svn path=/main/trunk/; revision=13900
-rw-r--r-- | pym/portage/util.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pym/portage/util.py b/pym/portage/util.py index 49eec6492..f1bff1d40 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -56,6 +56,9 @@ def writemsg(mystr,noiselevel=0,fd=None): if fd is None: fd = sys.stderr if noiselevel <= noiselimit: + if sys.hexversion < 0x3000000 and isinstance(mystr, unicode): + # avoid potential UnicodeEncodeError + mystr = mystr.encode('utf_8', 'replace') fd.write(mystr) fd.flush() |