ghjpk / planningcenter

OpenLP Plugin to Import Services from Planning Center Online
GNU General Public License v2.0
3 stars 1 forks source link

Crash if Bible Version missing #12

Open brownium opened 5 years ago

brownium commented 5 years ago

Traceback (most recent call last): File "/Applications/OpenLP.app/Contents/MacOS/plugins/planningcenter/forms/selectplanform.py", line 237, in on_import_as_new_button_clicked language_selection = bible_media.plugin.manager.get_language_selection(bible) File "openlp/plugins/bibles/lib/manager.py", line 306, in get_language_selection File "openlp/plugins/bibles/lib/manager.py", line 373, in get_meta_data KeyError: ''

victordmontero commented 3 years ago

I had the same issue on Windows 7 64 bits:

  File "\OpenLPPortable\App\OpenLP\plugins\planningcenter\forms\selectplanform.py", line 237, in on_import_as_new_button_clicked
    language_selection = bible_media.plugin.manager.get_language_selection(bible)
  File "openlp\plugins\bibles\lib\manager.py", line 306, in get_language_selection
  File "openlp\plugins\bibles\lib\manager.py", line 373, in get_meta_data
KeyError: ''
victordmontero commented 3 years ago

I found a temporal solution. It seems that bible variable is empty, hence the Key Error: ''. So what i did was to check for the length of the bible variable (which a string variable):

bible = bible_media.quickVersionComboBox.currentText()
if len(bible) > 0:
    language_selection = bible_media.plugin.manager.get_language_selection(bible)
    # replace long dashes with normal dashes -- why do these get inserted in PCO?
    tmp_item_title = re.sub('–','-',item_title)
    ref_list = parse_reference(tmp_item_title, bibles[bible], language_selection)
    if ref_list:
        bible_media.search_results = bibles[bible].get_verses(ref_list)
        bible_media.list_view.clear()
        bible_media.display_results(bible, '')
        bible_media.add_to_service()

Hope it helps.