That didn't really change anything.

GetNumberOfEventLogRecords() tells me there are 6 events,

However the object returned from ReadEvenLog() still only contains 3 objects

flags = win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
events = win32evtlog.ReadEventLog(hand, flags, 0)
>>> events
[<PyEventLogRecord object at 0x00C5C998>, <PyEventLogRecord object at
0x00C5C9E0>, <PyEventLogRecord object at 0x00C5CA28>]

The next call to ReadeventLog() returns None



On 7/11/09, Mark Hammond <skippy.hamm...@gmail.com> wrote:
> Check out the ReadEventLog code in win32evtlogutil.py - you will notice you
> need a loop like:
>
>         while 1:
>             objects = win32evtlog.ReadEventLog(h, readFlags, 0)
>             if not objects:
>                 break
>
>  Mark
>
>
>  On 11/07/2009 1:38 PM, Tony Cappellini wrote:
>
> >
> > Ok, I'm able to parse Event51 logs now.
> >
> > However, there seems to be a problem with the  object returned from
> > ReadEventLogs()
> >
> > GetNumberOfEvents() tells me there are 6 events.
> >
> > I can see all sixe events using the EventViewer in Control Panle, on
> Widnwos XP.
> >
> > However, the iterator returned from RedEvent Log() is consumned after
> > only 3 events.
> >
> >
> hand=win32evtlog.OpenBackupEventLog(None,logFilename)
> >
> numEvents=win32evtlog.GetNumberOfEventLogRecords(hand)
> >     print'\n\t%lu events were found' % numEvents
> >     flags =
> win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
> >     events=win32evtlog.ReadEventLog(hand,flags,0)
> >
> >     for ev_obj in events:
> >          #stops iterating after only 3 events
> >
> > Would someone verify this?
> >
> > I see this problem on Python 2.3 and 2.5.4, with Pywin32 Build 213
> >
> >
> > Thanks
> >
> > Tony
> > _______________________________________________
> > python-win32 mailing list
> > python-win32@python.org
> > http://mail.python.org/mailman/listinfo/python-win32
> >
>
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to