openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #30816
[Bug 1632567] Re: OpenLP importer AttributeError: 'OldSong' object has no attribute 'book'
I had the same problem. The database was made with trunk (17 Nov 2016)
on Fedora 23. When I upgraded to Fedora 25 today, trunk did not contain
the song database, and importing it with OpenLP 2 (.sqlite) format did
not work (I've attached the error log).
I have a patch to fix this, but I'm new to developing for OpenLP, so I
haven't sent it yet:
=== modified file 'openlp/plugins/songs/lib/importers/openlp.py'
--- openlp/plugins/songs/lib/importers/openlp.py 2016-05-27 08:13:14 +0000
+++ openlp/plugins/songs/lib/importers/openlp.py 2016-12-10 02:56:07 +0000
@@ -221,11 +221,14 @@
if not existing_book:
existing_book = Book.populate(name=entry.songbook.name, publisher=entry.songbook.publisher)
new_song.add_songbook_entry(existing_book, entry.entry)
- elif song.book:
- existing_book = self.manager.get_object_filtered(Book, Book.name == song.book.name)
- if not existing_book:
- existing_book = Book.populate(name=song.book.name, publisher=song.book.publisher)
- new_song.add_songbook_entry(existing_book, '')
+ else:
+ try:
+ existing_book = self.manager.get_object_filtered(Book, Book.name == song.book.name)
+ if not existing_book:
+ existing_book = Book.populate(name=song.book.name, publisher=song.book.publisher)
+ new_song.add_songbook_entry(existing_book, '')
+ except(AttributeError):
+ pass
# Find or create all the media files and add them to the new song object
if has_media_files and song.media_files:
for media_file in song.media_files:
The problem, as I see it, is that "elif song.book:" is not the proper
way to check if song has a book attribute because if song doesn't have
book, the call will throw AttributeError. Simply catching and ignoring
the error worked for me, but that might not be the correct solution.
** Attachment added: "The debug log given by the OpenLP GUI."
https://bugs.launchpad.net/openlp/+bug/1632567/+attachment/4789816/+files/complaint
--
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/1632567
Title:
OpenLP importer AttributeError: 'OldSong' object has no attribute
'book'
Status in OpenLP:
New
Bug description:
Importing .sqlite db into 2.4.3 portable.
Win 10
Traceback (most recent call last):
File "openlp\core\ui\wizard.py", line 216, in on_current_id_changed
File "openlp\plugins\songs\forms\songimportform.py", line 351, in perform_wizard
File "openlp\plugins\songs\lib\importers\openlp.py", line 224, in do_import
AttributeError: 'OldSong' object has no attribute 'book'
To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/1632567/+subscriptions
References