Skip to content
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

Confusing Error when feedparsing fails: KeyError: 'title' #28

Open
einvalentin opened this issue Nov 17, 2024 · 0 comments
Open

Confusing Error when feedparsing fails: KeyError: 'title' #28

einvalentin opened this issue Nov 17, 2024 · 0 comments

Comments

@einvalentin
Copy link

On Macos Version 14.6.1 (23G93) (Sonoma), the default python installation misses the SSL keychain. When trying to use tonie-podcast-sync, I get a confusing error message:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/valentin/venv/lib/python3.12/site-packages/feedparser/util.py:156 in getattr
│ │
│ 153 │ │ # getattribute() is called first; this will be called │
│ 154 │ │ # only if an attribute was not already found │
│ 155 │ │ try: │
│ ❱ 156 │ │ │ return self.getitem(key) │
│ 157 │ │ except KeyError: │
│ 158 │ │ │ raise AttributeError("object has no attribute '%s'" % key) │
│ 159 │
│ │
│ /Users/valentin/venv/lib/python3.12/site-packages/feedparser/util.py:113 in getitem
│ │
│ 110 │ │ │ │ │ │ return dict.getitem(self, k) │
│ 111 │ │ │ elif dict.contains(self, realkey): │
│ 112 │ │ │ │ return dict.getitem(self, realkey) │
│ ❱ 113 │ │ return dict.getitem(self, key) │
│ 114 │ │
│ 115 │ def contains(self, key): │
│ 116 │ │ if key in ('updated', 'updated_parsed'): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'title'

During handling of the above exception, another exception occurred:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/valentin/dev/tonie-podcast-sync/tonie_podcast_sync/cli.py:32 in update_tonies │
│ │
│ 29 │ │ return │
│ 30 │ for ct_key, ct_value in settings.CREATIVE_TONIES.items(): │
│ 31 │ │ tps.sync_podcast_to_tonie( │
│ ❱ 32 │ │ │ Podcast( │
│ 33 │ │ │ │ ct_value.podcast, │
│ 34 │ │ │ │ episode_sorting=ct_value.episode_sorting, │
│ 35 │ │ │ │ volume_adjustment=ct_value.volume_adjustment, │
│ │
│ /Users/valentin/dev/tonie-podcast-sync/tonie_podcast_sync/podcast.py:51 in init
│ │
│ 48 │ │ self.epSorting = episode_sorting # the sorting of the episode list │
│ 49 │ │ │
│ 50 │ │ self.feed = feedparser.parse(url) │
│ ❱ 51 │ │ self.title = self.feed.feed.title # title of podcast │
│ 52 │ │ self.refresh_feed() # reads feed and populates the episode list │
│ 53 │ │
│ 54 │ def refresh_feed(self) -> None: │
│ │
│ /Users/valentin/venv/lib/python3.12/site-packages/feedparser/util.py:158 in getattr
│ │
│ 155 │ │ try: │
│ 156 │ │ │ return self.getitem(key) │
│ 157 │ │ except KeyError: │
│ ❱ 158 │ │ │ raise AttributeError("object has no attribute '%s'" % key) │
│ 159 │ │
│ 160 │ def hash(self): │
│ 161 │ │ # This is incorrect behavior -- dictionaries shouldn't be hashable. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: object has no attribute 'title'

To fix it, you need to install the SSL certificates (follow https://stackoverflow.com/a/42098127)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant