From 78bc187c1f91e5cfeb536816801d77f9285f32d6 Mon Sep 17 00:00:00 2001 From: im85288 Date: Sat, 21 Mar 2015 09:03:43 +0000 Subject: [PATCH] support systems using python version less than 2.7 (such as Mac) --- resources/lib/CreateFiles.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/lib/CreateFiles.py b/resources/lib/CreateFiles.py index e6f21227..63b5e8d8 100644 --- a/resources/lib/CreateFiles.py +++ b/resources/lib/CreateFiles.py @@ -12,8 +12,6 @@ import time from calendar import timegm from datetime import datetime - - from xml.etree.ElementTree import Element, SubElement, Comment, tostring from xml.etree import ElementTree from xml.dom import minidom @@ -24,6 +22,7 @@ from API import API import Utils as utils from ReadEmbyDB import ReadEmbyDB + addon = xbmcaddon.Addon(id='plugin.video.mb3sync') addondir = xbmc.translatePath(addon.getAddonInfo('profile')) dataPath = os.path.join(addondir,"library") @@ -237,8 +236,15 @@ class CreateFiles(): SubElement(actor_elem, "name").text = utils.convertEncoding(actor.get("Name")) SubElement(actor_elem, "type").text = utils.convertEncoding(actor.get("Role")) SubElement(actor_elem, "thumb").text = downloadUtils.imageUrl(actor.get("Id"), "Primary", 0, 400, 400) - - ET.ElementTree(root).write(nfoFile, xml_declaration=True) + + # Some devices such as Mac are using an older version of python + try: + # 2.7 and greater + ET.ElementTree(root).write(nfoFile, xml_declaration=True) + except: + # <2.7 + ET.ElementTree(root).write(nfoFile) + return changes