Hi

Location based search code was working perfectly till Friday noon
after which I started getting the following error


IndexError: list index out of range

Please help



This is the part of my code

XML_OUT_NS = 'http://www.w3.org/2005/Atom'
        total_results = dom.getElementsByTagName('openSearch:totalResults')
[0].firstChild.data
        print total_results
        src_locn = url_locn
        url_locn_pos = url_locn.find(',')
        url_locn = url_locn[url_locn_pos+1:]
        c = 2
        for node in dom.getElementsByTagNameNS(XML_OUT_NS, 'entry'):
                title = node.getElementsByTagName('title')[0].firstChild.data
                print title
                title = string.replace(title, '&', '&')
                proxies = {'http': ''}
                event_box = gtk.EventBox()
                event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK)
                #event_box.connect("button_press_event", self.button_clicked,
catalog_id)
                #add the event box to the table
                table.attach(event_box, 0, 1, c, c+1, xoptions=gtk.EXPAND|
gtk.FILL|gtk.SHRINK, yoptions=gtk.EXPAND|gtk.FILL|gtk.SHRINK,
xpadding=0, ypadding=0);
                image = gtk.Image()
                if (node.getElementsByTagName('g:image_link')):
                        image_link = node.getElementsByTagName('g:image_link')
[0].firstChild.data
                        print image_link
                        try:
                                f = urllib.urlopen(image_link, proxies=proxies)
                                data = f.read()
                                #print data
                                pbl = gtk.gdk.PixbufLoader()
                                pbl.write(data)
                                #print pbl
                                pbuf = pbl.get_pixbuf()
                                if (pbuf != None):
                                        pbl.close()
                                        image.set_from_pixbuf(pbuf.scale_simple
(75,75,gtk.gdk.INTERP_BILINEAR))
                                else:
                                        
image.set_from_file('/opt/python_code/not_found.jpg')
                        except IOError,e:
                                print e
                                print 'Failed to open %s' % image_link
                else:
                        image.set_from_file('/opt/python_code/not_found.jpg')

                image.show()
                event_box.add(image)
                event_box.show()
               # the error is shown in this line
                location = node.getElementsByTagName('g:location')
[0].firstChild.data
                print location



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-base-data-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to