problem processing COMException in VB6

Jim Kerr jim_kerr at agilent.com
Wed Oct 3 02:19:26 CEST 2001


I've written a COM server in Python that is accessed by a VB6 client.
The client/server interaction works just fine, but I'm having a
problem displaying error messages in VB when the server throws an
exception. The problem is that VB seems to be displaying a generic
error message based upon the scode for the exception, and ignoring the
error description entirely. For example, if the server executes

 raise COMException(desc="No measurement defined on channel %d" %
channelNum, scode=winerror.DISP_E_BADINDEX)

and the VB client catches the exception with

    MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Server
Error"

then the message box displays the text "Subscript out of range"
instead of "No measurement defined on channel 3".

  I must be missing something obvious here...?

  BTW, I'm running ActivePython 2.1.211 on Windows 2000.

-Jim
==========
Jim Kerr
Software Engineer
Agilent Technologies, Inc.



More information about the Python-list mailing list