[python-win32] byref variant parameter problem
Shah
msdin@home.com
Wed, 17 Oct 2001 16:33:31 -0700
Hi,
I am writing a script that creates and calls functions
on a custom COM object. The object is used for error
handling. Basically, the caller dim's a variant and
passes it around. If an error occurs, this object takes
the variant, creates a disconnected ADOR.Recordset,
populates it with the error info, and assigns it to the
variant. For example (in VB code):
Public Function MyFunc() as Long
Dim errors as Variant
MyFunc2(errors, foo, bar)
if IsObject(errors) then
'log the errors
end if
end Function
Public Function MyFunc2(ByRef errors as Variant, _
ByVal foo, ByVal bar) as Long
'Create the error handler object
Dim errObj as New ErrHandler
On Error Goto ErrorHandler
'Do stuff
ErrorHandler:
'After this, errors will be a ADOR.Recordset
errObj.AddError(errors, desc)
MyFunc2 = 0
End Function
I'm basically trying to call MyFunc2 in Python.
If I call it like this:
retval = myObj.MyFunc2(None, foo, bar)
and an error is raised, I get an error message
'Object required' reported by the the error
object (errObj). I've tried passing it an
ADOR.Recordset instead, but then I get errors
regarding the state of the Recordset. The
errObj is supposed to create the recordset on
the fly. Everything works fine in VB, but
I get nowhere in Python. Any ideas?
Shah
msdin_NO@SPAM_home.com