[python-win32] Python parser for Windows Event Logs

Tony Cappellini cappy2112 at gmail.com
Fri Jul 17 14:46:31 CEST 2009


Message: 3
Date: Thu, 16 Jul 2009 16:08:51 -0700
From: Tim Roberts <timr at probo.com>
To: python-win32 at python.org
Subject: Re: [python-win32] Python parser for Windows Event Logs
Message-ID: <4A5FB303.7010303 at probo.com>
Content-Type: text/plain; charset=ISO-8859-1

Tony Cappellini wrote:
> I've added the While loop Mark suggested but still see the same issue.
> GetNumberOfEventLogRecords() still returns 6 events,
> However the object returned from ReadEvenLog() still only contains 3 objects
> The next call to ReadeventLog() returns None
>

>OK, in my test, repeated calls to ReadEventLog eventually fetch all of
>the events.  Each call to ReadEventLog will return however many events
>will fit in 1024 bytes, which is the buffer in the pywin32 code.  If I
>change your code to this:

>while 1:
>   events=win32evtlog.ReadEventLog(hand,flags,0)
>   if not events:
>       break
>   for event in events:
>       print event.EventID, event.StringInserts

>then it all works as expected.

This is what I'm doing. I have added the while 1 last week, after Mark
had suggested it.
It did not change anything. ReadEventLog() returns None on successive calls.

Which versions of Python and Pywin32 are you using?


More information about the python-win32 mailing list