openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #07582
[Bug 744337] Re: problems with unicode filesystem when export songs
** Description changed:
From my tests seems that lxml library has a problem in the write
function when should to write a filename with unicode characters (on
windows Xp environment).
A patch for solving this problem can be below code:
1) In the file openlp/plugins/songs/lib/openlysicsexport.py
replace the lines 78-79:
- tree.write(os.path.join(self.save_path, filename), encoding=u'utf-8', xml_declaration=True, pretty_print=True)
+ tree.write(os.path.join(self.save_path, filename), encoding=u'utf-8', xml_declaration=True, pretty_print=True)
with
- open(os.path.join(self.save_path, filename),'w').write(xml)
-
+ open(os.path.join(self.save_path, filename),'w').write(xml)
2) In the file openlp/plugins/songs/lib/openlysicsexport.py
- replace teh line 337-338
- return etree.tostring(xml, encoding=u'UTF-8', xml_declaration=True)
+ replace the line 337-338
+ return etree.tostring(xml, encoding=u'UTF-8', xml_declaration=True)
with
- return etree.tostring(xml, encoding=u'UTF-8', xml_declaration=True, pretty_print=True)
+ return etree.tostring(xml, encoding=u'UTF-8', xml_declaration=True, pretty_print=True)
+
+ The same problem into openlyricsimport.py
+
+ replace the line 66:
+ parsed_file = etree.parse(file_path, parser)
+ with
+ parsed_file = etree.parse(open(file_path, 'r'), parser)
** Tags added: import
--
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/744337
Title:
problems with unicode filesystem when export songs
Status in OpenLP - Worship Presentation Software:
New
Bug description:
From my tests seems that lxml library has a problem in the write
function when should to write a filename with unicode characters (on
windows Xp environment).
A patch for solving this problem can be below code:
1) In the file openlp/plugins/songs/lib/openlysicsexport.py
replace the lines 78-79:
tree.write(os.path.join(self.save_path, filename), encoding=u'utf-8', xml_declaration=True, pretty_print=True)
with
open(os.path.join(self.save_path, filename),'w').write(xml)
2) In the file openlp/plugins/songs/lib/openlysicsexport.py
replace the line 337-338
return etree.tostring(xml, encoding=u'UTF-8', xml_declaration=True)
with
return etree.tostring(xml, encoding=u'UTF-8', xml_declaration=True, pretty_print=True)
The same problem into openlyricsimport.py
replace the line 66:
parsed_file = etree.parse(file_path, parser)
with
parsed_file = etree.parse(open(file_path, 'r'), parser)
References