jsumners / jsumners/feedparser

TypeError: string indices must be integers

Open
#392 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-migrated
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

What steps will reproduce the problem?

>>> import feedparser
>>> feedparser.parse('http://www.t-shops.co.uk/poll/hidden/podcasting/rlm.xml')

What is the expected output?

  Feed is parsed correctly.

What do you see instead?

  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.7/dist-packages/feedparser.py", line 4013, in parse
      saxparser.parse(source)
    File "/usr/lib/python2.7/dist-packages/drv_libxml2.py", line 231, in parse
      _d(reader.Name()))
    File "/usr/lib/python2.7/dist-packages/feedparser.py", line 1870, in endElementNS
      self.unknown_endtag(localname)
    File "/usr/lib/python2.7/dist-packages/feedparser.py", line 717, in unknown_endtag
      method()
    File "/usr/lib/python2.7/dist-packages/feedparser.py", line 1534, in _end_category
      if value and len(tags) and not tags[-1]['term']:
  TypeError: string indices must be integers

What version of the product are you using? On what operating system?

  >>> feedparser.__version__
  '5.1.2'

  % dpkg -l python-feedparser
  Desired=Unknown/Install/Remove/Purge/Hold
  | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
  ||/ Name             Version       Architecture  Description
  +++-================-=============-=============-======================================
  ii  python-feedparse 5.1.2-1ubuntu all           Universal Feed Parser for Python

A copy of the feed in question is attached.

Original issue reported on code.google.com by th.perl@gmail.com on 25 Feb 2013 at 2:03

Attachments:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with feedparser 5.1.2 using the URL or attached rlm.xml, then inspect feedparser.py around _end_category at line 1534. Confirm the category data shape that causes the TypeError and verify that the feed parses correctly without the exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.