Fix the issue when failing to open unicode dir and rename filename to

filePath
This commit is contained in:
tzutalin
2017-02-16 14:49:41 +08:00
parent 70721ad597
commit c5ceaa687d
2 changed files with 72 additions and 69 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ from xml.etree.ElementTree import Element, SubElement
from lxml import etree
import codecs
XML_EXT = '.xml'
class PascalVocWriter:
@@ -101,7 +102,7 @@ class PascalVocWriter:
self.appendObjects(root)
out_file = None
if targetFile is None:
out_file = codecs.open(self.filename + '.xml', 'w', encoding='utf-8')
out_file = codecs.open(self.filename + XML_EXT, 'w', encoding='utf-8')
else:
out_file = codecs.open(targetFile, 'w', encoding='utf-8')