Add a print to assist with debugging

This commit is contained in:
Raoul Snyman 2019-03-26 14:14:33 -07:00
parent cdc3d68a2c
commit ce8996c8b9

View File

@ -51,6 +51,7 @@ class PresentationManagerImport(SongImport):
encoding = get_file_encoding(file_path)['encoding'] encoding = get_file_encoding(file_path)['encoding']
# Open file with detected encoding and remove encoding declaration # Open file with detected encoding and remove encoding declaration
text = file_path.read_text(encoding=encoding) text = file_path.read_text(encoding=encoding)
print(text)
text = re.sub(r'.+\?>\n', '', text) text = re.sub(r'.+\?>\n', '', text)
try: try:
tree = etree.fromstring(text, parser=etree.XMLParser(recover=True)) tree = etree.fromstring(text, parser=etree.XMLParser(recover=True))
@ -59,12 +60,7 @@ class PresentationManagerImport(SongImport):
translate('SongsPlugin.PresentationManagerImport', translate('SongsPlugin.PresentationManagerImport',
'File is not in XML-format, which is the only format supported.')) 'File is not in XML-format, which is the only format supported.'))
continue continue
xml = etree.tostring(tree) root = objectify.fromstring(etree.tostring(tree))
if tree.docinfo.encoding.lower() != 'unicode':
# If the XML string is a bytes object, lxml sometimes croaks
xml = xml.decode(tree.docinfo.encoding)
print(xml)
root = objectify.fromstring(xml)
self.process_song(root, file_path) self.process_song(root, file_path)
def _get_attr(self, elem, name): def _get_attr(self, elem, name):