July 19th, 2004, 09:45 PM
Join Date: Oct 2003
Time spent in forums: 3 h 44 m 17 sec
Reputation Power: 0
How do I defeat the Index out of range error
I am working with the pyAmazon module to download Product Information from Amazon. I am having problems determining the highest item number. I keep trying higher index numbers until I get a traceback error.
What is the best way to trap the error to get the last item in the index? I know this sounds like a stupid question, but I am new to Python and am not sure about the best way to handle this. Here is how I get the error.
>>> Results = amazon.searchByKeyword('"python in a nutshell"', product_line="books", type="heavy", page=1, license_key=None, http_proxy=None, locale=None, associate=None)
Traceback (most recent call last):
File "<pyshell#38>", line 1, in -toplevel-
IndexError: list index out of range