gpodder / gpodder

The gPodder podcast client.
http://gpodder.org/
GNU General Public License v3.0
1.27k stars 203 forks source link

KeyError: 0 when updating feeds with PyXML installed and gPodder 3.9.2 #185

Closed oldpink closed 7 years ago

oldpink commented 7 years ago

Well, I was a bit excited that a new revision of gPodder had been released, so I dutifully downloaded, then installed it. The first error I noticed was that, although it seemed to be going through the process of checking for new episodes in my existing list of podcasts, it consistently failed to download any new podcasts, even though I knew new ones were coming in over just the last few minutes. Failing that, I deleted my GPODDER_HOME directory (.gPodder for me), then started it again, this time attempting to retrieve my complete podcast list that I had saved on gpodder.net. Again, it seemed to be downloading the list, even showing the names of all the podcasts, at which point I clicked "Select All" to allow it to load them, then waited, only to see it fail on all of them, with the error you can see in the screenshot below:

gpodder_error

I also saved the terminal output for more information, and you can see that below:

out.txt

I have never had this problem with all the many revisions of this excellent (there is not even a single other RSS feed/podcast downloader that approaches how good gPodder is) program, but I value being able to listen to my daily podcasts, so I reluctantly deleted 3.9.2 and reinstalled 3.9.1 for now, and I'm back to being able to download my podcasts, although I had to first delete my GPODDER_HOME directory, then restore from my backed up copy of the same directory from before I had tested 3.9.2, because the older revision of gPodder refused to download a thing until then, which makes it clear that the newer revision had somehow polluted the directory. I'm still able to get my podcasts, but I have to stick to the older revision for the time being until I figure out what's wrong with the new revision. Thanks in advance for anything you can help me with.

elelay commented 7 years ago

Pending further evaluation, I've reverted sourceforge default OSX download to 3.9.1.

oldpink commented 7 years ago

Just an FYI here, but I am having the problems that I posted about on Linux, not OSX. I'm staying with 3.9.1 for now, but I see that I'm not the only one having problems with 3.9.2.

thp commented 7 years ago

Can you run gPodder with:

gpodder --verbose | tee gpodder-log.txt

Then reproduce the issue (so you get the dialog as in the screenshot above) and then post the gpodder-log.txt created here?

oldpink commented 7 years ago

Okay, I did as requested, and here is the output of that attached below. gpodder-log.txt

thp commented 7 years ago

Thanks. For some reason it seems to be using _xmlplus for parsing, according to this answer on Stack Overflow it's from PyXML which seems to be unmaintained.

Since we probably can't control what outdated software users have installed, can you try applying the following patch to podcastparser.py locally and see if that fixes your problem?

diff --git a/podcastparser.py b/podcastparser.py
index eae45d2..db7a6e2 100644
--- a/podcastparser.py
+++ b/podcastparser.py
@@ -73,7 +73,16 @@ class Target(object):

 class RSS(Target):
     def start(self, handler, attrs):
-        if 'xml:base' in attrs:
+        try:
+            have_xml_base = 'xml:base' in attrs
+        except KeyError:
+            # Work around bug in PyXML:
+            #   File "/usr/lib64/python2.7/site-packages/_xmlplus/sax/xmlreader.py", line 316, in __getitem__
+            #     return self._attrs[name]
+            # KeyError: 0
+            have_xml_base = False
+
+        if have_xml_base:
             handler.set_base(attrs.get('xml:base'))
thp commented 7 years ago

I was able to reproduce the bug by manually installing PyXML here. There's an even easier fix here: https://github.com/gpodder/podcastparser/pull/3

thp commented 7 years ago

Fixed in podcastparser release 0.6.1: http://gpodder.org/podcastparser/

oldpink commented 7 years ago

I was able to fix my problems (mostly), also by updating to podcastparser 0.6.1, with my podcasts now restoring properly from my list of podcasts saved on gpodder.net, with one exception, a specific podcast that still fails, whether I try using the restored list from gpodder,net, or when I tried to manually add the problem podcast URL into the "Add podcast via URL" option.

http://media.wfyi.org/wfyi/audio/IWIR/IWIR.rss ...which gives me the following text in the popup: Could not add some podcasts Some podcasts could not be added to your list: http://media.wfyi.org/wfyi/audio/IWIR/IWIR.rss: bad request

I can also confirm that reverting to 3.9.1 gives me no such woes, so something about this specific podcast must be choking 3.9.2, but (again) I have no idea what. Here is the capture of "gpodder --verbose |& tee gpodder-3.9.2_error.txt"

gpodder-3.9.2_error.txt

As an aside, I inserted the "&" to the capture command because it was insufficient to capture only stdout to get tee to save the errors, but I needed instead to capture stderr for that purpose. Thanks very much for getting me 95% of the way there, really, but there's clearly at least one tiny bug that will force me to stick with the previous version of gPodder for the time being. I'll help in any way I can still, all the better to see to it that others won't likewise have problems.