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

vml victor.lebrun at gmail.com
Fri May 4 03:44:40 EDT 2007


On 4 mai, 06:56, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Thu, 03 May 2007 09:41:57 -0300,vml<victor.leb... at gmail.com> escribió:
>
> > On 3 mai, 14:20, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> >> En Thu, 03 May 2007 04:54:43 -0300,vml<victor.leb... at gmail.com>
> >> escribió:
>
> >> > I have a python com object which contains a method to inverse an array
> >> > in vb 6 the definition of the class is :
>
> > I just tried to replace the *val by SqVal(self,val) and call the
> > method in vb but it crashes down :
>
> > "when refilling safe array the sequence must have the same number of
> > dimension as the existing array"
>
> That can't happen with your Python code below, so it must be on the
> caller. Maybe you wrote something like: xx=something.SqVal(yy) and xx,yy
> are declared of different sizes.
>

It is true that I call the python routine like that in vb :


 toto = obj.SqVal(ty)

If I am understanding well I need to pass an array of 2x2 and I should
retireve an array of variant of 2x2 ....

I tried to do that :
vb6 :

Dim obj As Object
    Dim toto(1, 1, 2) As Variant

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

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

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



    toto = obj.SqVal(ty)



but it is saying that the compiler can not assign the array toto at
the line toto=obj.SqVal().... hum strange .....



any ideas ?


Thank you for your help !






> >  def SqVal(self,val):
> > ## ...
> >         return val
>
> > By the way Do you have any idea to debug the com server script ? ( I
> > would like to know if a can access the value in the function while
> > calling it from vb 6)
>
> Write a log file as suggested, or use OutputDebugString with the DebugView
> program fromwww.sysinternals.com
>
> --
> Gabriel Genellina





More information about the Python-list mailing list