Picard closes when matching a specific release using the Wikidata Plugin

I’m pretty sure this is a Wikidata Genre plugin issue, but since I can’t find a dedicated thread on that plugin I thought to post this here.

When trying to match this release:

Picard closes without any warning or giving any indication on the problem.
I’m guessing it has to do with the :peace_symbol:︎ symbol that is present in the title?

1 Like

I can confirm that I have reproduced this issue. It only crashes with WikiData Genres enabled and doesn’t give a console error message.

Wasn’t able to debug further - sorry.

1 Like

I’m not sure what that means?
(running Windows portable version)
It just closes suddenly, and after restarting it, the period in which it happened is not in the debug report.
This is a screenshot right before it crashes:

Does that release work when using Wikidata Genre on your system?

The exact same issue with a different release:

The plugin tries to iterate over an empty response and crashes.

Traceback (most recent call last):
  File "./picard/webservice/__init__.py", line 514, in _process_reply
    self._handle_reply(reply, request)
  File "./picard/webservice/__init__.py", line 501, in _handle_reply
    handler(document, reply, error)
  File "/home/gabri/.config/MusicBrainz/Picard/plugins/wikidata.zip/wikidata/__init__.py", line 229, in parse_wikidata_response
TypeError: 'NoneType' object is not iterable

P.S.: YouTube recommended me a great song while I was searching for this.


Helps reminding that all this bits-and-bytes challenges we are all confronting here are only in service of one single purpose.

@gabrielcarvfer Any chance you can make a PR to fix this?

Depends on what you mean by fix. A workaround is pretty easy.

    def parse_wikidata_response(self, item, item_id, genre_source_type, response, reply, error):
                                if tmp == node1.attribs.get('about'):
                                    list1 = node1.children.get('name')
                                    if not list1: ###### This if-else block prevents the crash and logs the error
                                    	log.debug('WIKIDATA: Response does not contain a name field')
                                    else:  ##########
                                        for node2 in list1:
                                            if node2.attribs.get('lang') == 'en':
                                                genre = node2.text.title()
                                                if not matches_ignored(self.ignore_these_genres_list, genre):
                                                    log.debug('New genre has been found and ALLOWED: %s' % genre)
                                                    log.debug('New genre has been found, but IGNORED: %s' % genre)

@gabrielcarvfer Thanks.