[python-win32] byref variant parameter problem
Mark Hammond
MarkH@ActiveState.com
Thu, 18 Oct 2001 10:06:55 +1000
Try passing pythoncom.Empty in place of None.
Mark.
> -----Original Message-----
> From: python-win32-admin@python.org
> [mailto:python-win32-admin@python.org]On Behalf Of Shah
> Sent: Thursday, 18 October 2001 9:34 AM
> To: python-win32@python.org
> Subject: [python-win32] byref variant parameter problem
>
>
> 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
>
>
>
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32