~raoul-snyman/openlp/fix-macos-pdf-test

« back to all changes in this revision

Viewing changes to openlp/plugins/songs/lib/importers/presentationmanager.py

  • Committer: Raoul Snyman
  • Date: 2019-03-26 21:14:33 UTC
  • Revision ID: raoul@snyman.info-20190326211433-uzlrcfreifhjgh9s
Add a print to assist with debugging

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
                encoding = get_file_encoding(file_path)['encoding']
52
52
                # Open file with detected encoding and remove encoding declaration
53
53
                text = file_path.read_text(encoding=encoding)
 
54
                print(text)
54
55
                text = re.sub(r'.+\?>\n', '', text)
55
56
                try:
56
57
                    tree = etree.fromstring(text, parser=etree.XMLParser(recover=True))
59
60
                                   translate('SongsPlugin.PresentationManagerImport',
60
61
                                             'File is not in XML-format, which is the only format supported.'))
61
62
                    continue
62
 
            xml = etree.tostring(tree)
63
 
            if tree.docinfo.encoding.lower() != 'unicode':
64
 
                # If the XML string is a bytes object, lxml sometimes croaks
65
 
                xml = xml.decode(tree.docinfo.encoding)
66
 
            print(xml)
67
 
            root = objectify.fromstring(xml)
 
63
            root = objectify.fromstring(etree.tostring(tree))
68
64
            self.process_song(root, file_path)
69
65
 
70
66
    def _get_attr(self, elem, name):