[Tutor] SGMLLib, fetching some weird data

Kent Johnson kent37 at tds.net
Mon Aug 14 14:11:15 CEST 2006


Basil Shubin wrote:
> Hi friends,
>
> Please, examine attached script. I want fetch some data from online 
> resource and almost achieve this, but I can't fetch some weird formatted 
> data like this '45° Reverse Calf Press'. I got the following error:
>
> 45
>   Reverse Calf Press
> Reverse Calf Raise
> Seated Reverse Calf Press
> Traceback (most recent call last):
>    File "net_exrx.py", line 226, in ?
>      exercisesList = LoadExercisesList(2, 4, 9)
>    File "net_exrx.py", line 86, in LoadExercisesList
>      return parser.GetExercisesList()
>    File "net_exrx.py", line 176, in GetExercisesList
>      self.exerList.append([self.desc[i],self.urls[i]])
> IndexError: list index out of range
>   
Apparently self.desc has more entries than self.urls. This would happen 
if handle_data() is called more than once for an <a> tag. If you put 
some print statements in your program you can probably figure out why 
this is happening.

Kent



More information about the Tutor mailing list