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
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to