New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
oldpink opened this Issue Dec 6, 2016 · 8 comments

Comments

Projects
None yet
3 participants
@oldpink

oldpink commented Dec 6, 2016

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

This comment has been minimized.

Show comment
Hide comment
@elelay

elelay Dec 6, 2016

Member

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

Member

elelay commented Dec 6, 2016

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

@oldpink

This comment has been minimized.

Show comment
Hide comment
@oldpink

oldpink Dec 13, 2016

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.

oldpink commented Dec 13, 2016

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

This comment has been minimized.

Show comment
Hide comment
@thp

thp Dec 17, 2016

Member

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?

Member

thp commented Dec 17, 2016

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

This comment has been minimized.

Show comment
Hide comment
@oldpink

oldpink Dec 17, 2016

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

oldpink commented Dec 17, 2016

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

@thp

This comment has been minimized.

Show comment
Hide comment
@thp

thp Dec 17, 2016

Member

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'))
Member

thp commented Dec 17, 2016

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

This comment has been minimized.

Show comment
Hide comment
@thp

thp Dec 17, 2016

Member

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

Member

thp commented Dec 17, 2016

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

@thp thp changed the title from Bug with gPodder v. 3.9.2 to KeyError: 0 when updating feeds with PyXML installed and gPodder 3.9.2 Dec 17, 2016

@thp

This comment has been minimized.

Show comment
Hide comment
@thp

thp Dec 17, 2016

Member

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

Member

thp commented Dec 17, 2016

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

@thp thp closed this Dec 17, 2016

@oldpink

This comment has been minimized.

Show comment
Hide comment
@oldpink

oldpink Dec 18, 2016

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.

oldpink commented Dec 18, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment