while traversing I get out of index error as mentioned below.
class EventTimeFilter:
def __init__(self):
* self.event = [Event()]*
def populateScheduleData(self):
self.doc = libxml2.parseFile(self.FILENAME)
for eachcamera in
self.doc.xpathEval('SetDeviceConfiguration/Camera/.'):
cameraIndex = eachcamera.get_properties()
#print cameraIndex
index = int(cameraIndex.content,10)
print index
xpathEventType = 'SetDeviceConfiguration/[EMAIL PROTECTED]' +
cameraIndex.content +']/Filter/Event'
for searchResults in self.doc.xpathEval(xpathEventType):
eventType = searchResults.get_properties()
* self.event[index-1].cameraEventType = eventType.content #
Error*
*#Error as below*
self.event[index-1].cameraEventType = eventType.content
IndexError: list index out of range
Any guidance why I am getting *list index out of range error*?
index value runs from 1 to 4.
Thanks for all your help.
Alok
On Wed, May 28, 2008 at 1:09 AM, Casey McGinty <[EMAIL PROTECTED]>
wrote:
>
> self.event[] = Event() *# Seems this is not allowed ?? *
>>
>
> self.event = [Event()]
>
> - Casey
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Regards
Alok Kumar
--
http://mail.python.org/mailman/listinfo/python-list