[python-win32] win32evtlogutil.SafeFormatMessage don't work with
some events
Y. H. Rhiu
master at hilug.org
Thu Jan 15 22:22:53 EST 2004
I installed wmi module and excuted the code below.
(I think wmi module is a little slow, but useful.)
import wmi
c = wmi.WMI (privileges=["Security"])
watcher = c.watch_for (
notification_type="Creation",
wmi_class="Win32_NTLogEvent",
Type="error"
)
while 1:
error = watcher ()
print "Error in %s log: %s" % (error.Logfile, error.Message)
However, when "error = watcher ()" line is excuted, pythonwin is down.
(I'm using PythonWin 2.3.2 and Windows 2003 Enterprise.)
How can I fix it?
--
Y.H. Rhiu
> >I would like to monitor events about disk error of win2003 server.
> >So I wrote a python code capture 'Disk' event or 'dmio' event.
> >
> >But I've realized win32evtlogutil.SafeFormatMessage() don't
> >work with 'dmio' event.
> >So I can't see description of 'dmio' event by my python code below.
> >(but we can see the description by using windows event viewer.)
>
> I'm not an expert in event log stuff, but can I suggest this
> as an alternative method of monitoring:
>
> http://tgolden.sc.sabren.com/python/wmi_cookbook.html#monitor_error_events
>
> If you think it'll help and you're not sure how to alter
> it to suit what you're doing, I'm happy to help you
> adapt it.
>
> TJG
>
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________
More information about the Python-win32
mailing list