From a6a36a91308f4303fdc723f354b7b88e55b84620 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 10 May 2016 17:18:22 +0300 Subject: bitbake: toaster: read timezone files in binary mode Used 'rb' mode to open files to avoid unicode error when code runs on python 3: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 44: invalid start byte [YOCTO #9584] (Bitbake rev: 9e89fbe5682943d0d7e532d0a9f6188f60ba2349) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastermain/settings.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 78702fa59e..ce232e0865 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -134,17 +134,16 @@ else: try: import pytz from pytz.exceptions import UnknownTimeZoneError - pass try: if pytz.timezone(zonename) is not None: - zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename except UnknownTimeZoneError as ValueError: # we expect timezone failures here, just move over pass except ImportError: - zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename - TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] + TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime', 'rb').read()).hexdigest()] # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html -- cgit v1.2.3-54-g00ecf