diff --git a/bin/cordova_plist_to_config_xml b/bin/cordova_plist_to_config_xml index e781c630d..0d61b3b93 100755 --- a/bin/cordova_plist_to_config_xml +++ b/bin/cordova_plist_to_config_xml @@ -23,11 +23,12 @@ Converts a project's Cordova.plist file into a config.xml one. This conversion i Usage: plist2xml.py path/to/project """ +from __future__ import print_function -import StringIO import fileinput -import plistlib +import io import os +import plistlib import re import sys from xml.dom import minidom @@ -88,10 +89,10 @@ def ConvertPlist(src_path, dst_path): root.append(ElementTree.Element('access', attrib={'origin':value})) tree = ElementTree.ElementTree(root) - s = StringIO.StringIO() - tree.write(s, encoding='UTF-8') - mini_dom = minidom.parseString(s.getvalue()) - with open(dst_path, 'w') as out: + with io.BytesIO() as s: + tree.write(s, encoding='UTF-8') + mini_dom = minidom.parseString(s.getvalue()) + with open(dst_path, 'wb') as out: out.write(mini_dom.toprettyxml(encoding='UTF-8')) @@ -101,7 +102,7 @@ def UpdateProjectFile(path): if 'Cordova.plist' in line: line = line.replace('Cordova.plist', 'config.xml') line = line.replace('lastKnownFileType = text.plist.xml', 'lastKnownFileType = text.xml') - print line, + print(line, end=' ') file_handle.close()