passing an array of variant in vb to a python COM object = win32com bug ?

vml victor.lebrun at gmail.com
Thu May 3 03:54:43 EDT 2007


I have a python com object which contains a method to inverse an array
in vb 6 the definition of the class is :

class Fop:
    _public_methods_ = [ 'SqVal' ]
    def SqVal(self,*val):
        #vol=(val[0][0],val[0][1])
        #mat1=mat((vol))
        #up=linalg.inv(mat1)
        return str(val)#up
    _reg_verprogid_ = "Python.Fop.3"
    _reg_progid_ = "Python.Fop"
    _reg_desc_ = "Python Fop"
    _reg_clsid_ = "{30BD3490-2632-11cf-AD5B-524153480001}"

I pass to this method an array of variant which is the matrix to
invert like that:
vb6 code :


   Set obj = CreateObject("Python.Fop")
    Dim ty(1, 1) As Variant

    ty(0, 0) = 1
    ty(1, 0) = 2
    ty(0, 1) = 3
    ty(1, 1) = 4

    toto = obj.SqVal(ty)


when I dispaly toto as str(val) I obtain the following tuple "(((1,
3), (2, 4)),)" which is not usable ....

Do you have an idea to explain this strange behaviour ?

thank you !




More information about the Python-list mailing list