Revert "Fix encode filename issues python2"

This reverts commit 62507a1958.
This commit is contained in:
tzutalin
2017-02-15 20:35:57 +08:00
parent 62507a1958
commit 8239d1811b
2 changed files with 29 additions and 28 deletions
+4 -3
View File
@@ -5,7 +5,8 @@ import sys
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from lxml import etree
import io
import codecs
class PascalVocWriter:
@@ -100,9 +101,9 @@ class PascalVocWriter:
self.appendObjects(root)
out_file = None
if targetFile is None:
out_file = io.open(self.filename + '.xml', 'w', encoding='utf-8')
out_file = codecs.open(self.filename + '.xml', 'w', encoding='utf-8')
else:
out_file = io.open(targetFile, 'w', encoding='utf-8')
out_file = codecs.open(targetFile, 'w', encoding='utf-8')
prettifyResult = self.prettify(root)
out_file.write(prettifyResult.decode('utf8'))