Is the 'Headline News' gramplet working?

The gramplet was not showing RSS feeds for my computer when tested a few days ago… (All it shows is a single line: “Gramps Wiki Headline News [wiki]”… how about for you?)

So when that Gramplet showed up in today’s check for updated addons, I downloaded & updated. It STILL didn’t work and the Console showed the messages below.

2022-09-23 21:36:49.465: WARNING: _gramplet.py: line 342: Gramplet gave an error: Headline News
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\plug\_gramplet.py", line 326, in _updater
    retval = next(self._generator)
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\HeadlineNewsGramplet\HeadlineNewsGramplet.py", line 148, in main
    self.render_text(self.decode_wiki(text).strip())
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\plug\_gramplet.py", line 201, in render_text
    self.gui.render_text(text)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gui\widgets\grampletpane.py", line 480, in render_text
    markup, attr = parse_tag_attr(text[i+1:i+stop])
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gui\widgets\grampletpane.py", line 121, in parse_tag_attr
    attribute, value = av.split("=", 1)
ValueError: not enough values to unpack (expected 2, got 1)
Continuing after gramplet error...

Checking the GitHub repository to see what had been changed was worrying. Neither of the files in HeadlineNewsGramplet had changed in more than 2 years.

During a multiple value assignment, the ValueError: not enough values to unpack occurs when either you have fewer objects to assign than variables, or you have more variables than objects. This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error happened mostly in the case of using python split function. Verify the assignment variables. If the number of assignment variables is greater than the total number of variables, delete the excess variable from the assignment operator. The number of objects returned, as well as the number of variables available are the same.

To see what line is causing the issue, you could add some debug statements like this:

if len(line.split()) != "xx":
    print line

This will resolve the value error.

1 Like

I don’t have a “News & Releases” gramplet. The “Headline News” gramplet does not give me any warnings, but neither does it give any information (just displays “Loading Gramps Headline News…”). Where do you see the warnings? In some log?

Maybe the “Blog” tab on the web site should be renamed “Release History”.

News & Releases is in the footer of the WordPress homepage of the Gramps-Project.org domain.

The warning is send to the log monitored in the Status Bar. Accessible by clicking the lightbulb that appears at the left of the Statusbar after a warn-worthy event:
image
The warning is not actionable… gave WHAT error???


The Console is a bit more forthcoming:


2022-12-17 11:15:45.465: WARNING: _gramplet.py: line 342: Gramplet gave an error: Headline News
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\plug\_gramplet.py", line 326, in _updater
    retval = next(self._generator)
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\HeadlineNewsGramplet\HeadlineNewsGramplet.py", line 148, in main
    self.render_text(self.decode_wiki(text).strip())
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\plug\_gramplet.py", line 201, in render_text
    self.gui.render_text(text)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gui\widgets\grampletpane.py", line 480, in render_text
    markup, attr = parse_tag_attr(text[i+1:i+stop])
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gui\widgets\grampletpane.py", line 121, in parse_tag_attr
    attribute, value = av.split("=", 1)
ValueError: not enough values to unpack (expected 2, got 1)
Continuing after gramplet error...
1 Like

This is related to a bad link in the HeadlinesNews page. [fixed in Gramps 5.1.6]
Some links are incorrect because they contains spaces.

I solved this by modifying HeadlinesNewsGramplet.py .

        # Internal wiki URL:
        pattern = re.compile(r'\[\[(.*?)\]\]')
        matches = pattern.findall(text)
        for match in matches:
            text = text.replace("[[%s]]" % match,
                                ("""<A HREF="%s">%s</A>""" %
                                 (self.wiki(match).replace(' ','%20'), self.nice_title(match))))

Above line 276, I added .replace(' ', '%20') :

             (self.wiki(match)**.replace(' ','%20')**, self.nice_title(match))))

Thanks! That fixes the Gramplet problem on my Windoze box. Nice to have the add-on working again!

Will you be applying your fix to the 5.1 version and issuing an updated Gramplet via the Plugin Manager? Bug Report posted, if that helps: [0012774: [HeadlineNews Gramplet] fails after 1st line - Gramps - Bugtracker – Free Genealogy Software]