bzr-revno: 1457
Fixes: https://launchpad.net/bugs/744337
This commit is contained in:
Andreas Preikschat 2011-04-12 23:20:21 +02:00
commit e72e9c8952
2 changed files with 6 additions and 2 deletions

View File

@ -73,6 +73,8 @@ class OpenLyricsExport(object):
u', '.join([author.display_name for author in song.authors]))
filename = re.sub(
r'[/\\?*|<>\[\]":<>+%]+', u'_', filename).strip(u'_')
tree.write(os.path.join(self.save_path, filename),
# Pass a file object, because lxml does not cope with some special
# characters in the path (see lp:757673 and lp:744337).
tree.write(open(os.path.join(self.save_path, filename), u'w'),
encoding=u'utf-8', xml_declaration=True, pretty_print=True)
return True

View File

@ -63,7 +63,9 @@ class OpenLyricsImport(SongImport):
self.import_wizard.incrementProgressBar(
WizardStrings.ImportingType % os.path.basename(file_path))
try:
parsed_file = etree.parse(file_path, parser)
# Pass a file object, because lxml does not cope with some
# special characters in the path (see lp:757673 and lp:744337).
parsed_file = etree.parse(open(file_path, u'r'), parser)
xml = unicode(etree.tostring(parsed_file))
if self.openLyrics.xml_to_song(xml) is None:
log.debug(u'File could not be imported: %s' % file_path)