passing dictionaries through COM

dsavitsk dsavitsk at e-coli.net
Fri Jan 11 15:04:34 EST 2002


or leave it in the dictionary, add amethod to return the keys,  and add a
method that lets you get at what you need. i.e.

def get_keys():
    return self.mydict.keys()

def get_value(key):
    return self.mydict[key]

this always seems easier to me, and seems to use more python and less VB.
one caveat -- if you run code like this inside the VB IDE updating values
can fail.  this is due to how VB deals with late bound objects, which is to
say not very well.

-doug


"Ken Guest" <kwg at renre-europe.com> wrote in message
news:mailman.1010747715.4242.python-list at python.org...
> hi,
> Does anybody know if it is possible to return a dictionary through COM
> to a VB application?
> I have tried a simple return {1: "a", 2: "b"} from my python code and
> get an error raised "Unexpected Python Error: exceptions.TypeError:
> Objects of type 'dictionary' can not be converted to a COM VARIANT' and
> was wondering if there is any 'deep magic'/advanced method of
> transferring a dictionary of information to a COM based client.
>
> Any help/advice would be greatly appreciated
>
> --
> The duck quacks.
>
>





More information about the Python-list mailing list