Passing COM VB6 strings weirdness

U-CDK_CHARLES\Charles "Charles Krug" at cdksystems.com
Fri Apr 16 09:19:27 EDT 2004


List:

I've a Python COM server that keeps an event logs.

I've been using it from VB6:

logEvent "Message"

The Python side of things looks like:

def logEntry(self, caller = u'Unknown Caller', \
                 message = u'Unknown Message'):
        if self.fileOpen == True:
            return self.__Logger(str(caller), str(message))
        else:
            return -1
        

The which refers back to the base logger class method:

def __call__(self, caller = 'Unknown Caller', \
                 message = 'Unknown Message'):
        self.logFile.write(ctime(time()) + ', <' + caller \
                                       + '>, -- ' + message + '\n')
        return 0
    
When I log certain events from VB, I also display a message box for the
user or for me, depending on the specific message.

If I call messageBox BEFORE I invoke logEntry, all is well.

BUT if I invoke logEntry first, the passed string becomes a literal
zero.

Any thoughts on this?  I'm not certain why I'm getting the returned
value from this at all, let alone why it's being assigned to the
argument string.

Is my code telling Python to alter the value or is this a VB oddity?

Thanks


Charles







More information about the Python-list mailing list