[python-win32] Issue with win32evtlog.ReportEvent
Chris Frantz
frantzcj at gmail.com
Tue Apr 12 18:14:01 CEST 2011
Hello,
I'm having a bit of trouble with ReportEvent: When I use a large value for
eventID, I get an OverflowError.
>>> import win32evtlogutil
>>> win32evtlogutil.ReportEvent('FooBar', 0xc0004652)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python26\lib\site-packages\win32\lib\win32evtlogutil.py", line
80, in ReportEvent
data)
OverflowError: long int too large to convert to int
The prototype for ReportEvent (or rather it's wrapper) is:
PyObject * MyReportEvent(HANDLE hEventLog,
WORD wType,
WORD wCategory,
DWORD dwEventID,
PyObject *obSID,
PyObject *obStrings,
PyObject *obData)
I've noticed the SWIG generated interface for this wrapper uses
PyArg_ParseTuple to parse the input parameters. Specifically, it uses the
'l' (lower case ell) specifier to extract dwEventID. After reading the
documentation for PyArg_ParseTuple, I believe that the 'k' specifier is more
appropriate.
Unfortunately, I'm no SWIG wrangler, so I have no idea how to convince SWIG
to use a different specifier for DWORD and other unsigned long types.
Any ideas?
Thanks,
--Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110412/6c404a78/attachment.html>
More information about the python-win32
mailing list