[python-win32] win32com- Type mismatch on a string... Possible hash key collision? (original) (raw)

Reedick, Andrew jr9445 at ATT.COM
Thu Jan 3 16:08:47 CET 2008


-----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-_ _bounces at python.org] On Behalf Of Tim Roberts Sent: Wednesday, January 02, 2008 4:56 PM To: Python-Win32 List Subject: Re: [python-win32] win32com- Type mismatch on a string... Possible hash key collision?

Actually, the 2nd Fields is an IList object which contains a list of TDFields. I'm not 100% sure what the interface to an IList is, but you might try ["BUG"] instead of ("BUG").

("BUG"), ["BUG"], and (["BUG"]) all fail with the same type mismatch error. Why would I need to use tuple and/or array syntax to walk a list?

I'm expecting self.tdc.Customization.Fields.Fields("BUG") to simply return a list that I can iterate over.

self.tdc.Customization.Fields is Public Property Fields() As Object

self.tdc.Customization.Fields.Fields is Public Property Fields( Optional ByVal TableName As String = "" ) As List Remarks If an empty string is passed as TableName, returns a list of the fields in all tables

List has Count and Item methods.

I may be a Python newbie but it shouldn't be this difficult to walk a list. By comparison, here's the Perl equivalent: my custFields=custFields = custFields=tdc->Customization->Fields->Fields($db); for(my i=1;i=1; i=1;i<=$custFields->Count; $i++) { my field=field = field=custFields->Item($i); ... }



More information about the python-win32 mailing list