Mark, I had to make that suggested change in two places in framework.py, plus a change at around line 408 where FindBuildSubItemEvents tries to call GetFuncDesc on the defaultType returned from GetDefaultSourceTypeInfo:
defaultType = self.GetDefaultSourceTypeInfo(typeinfo) #***** WESTDEV EDIT **************************** if defaultType != None: #********************************************** index = 0 while 1: ... This finally allows our tiny test script (just creates a text file in c:\temp) to run successfully, so I will now pass a copy of the amended framework.py to our customer to see if this allows him to make some progress with his own 'real' scripts. Best regards, David -----Original Message----- From: Mark Hammond [mailto:mhamm...@skippinet.com.au] Sent: 05 April 2012 00:17 To: David Manns Cc: python-win32@python.org Subject: Re: [python-win32] IActiveScript::AddNamedItem fails with exception On 4/04/2012 8:20 PM, David Manns wrote: > Mark, > > Thanks, that's better! > > Now I get this trace output: > > Collecting Python Trace Output... > Object with win32trace dispatcher created (object=None) > in <win32com.axscript.client.pyscript.PyScript instance at > 0x058BF300>._InvokeEx_-SetScriptSite(<PyIActiveScriptSite at > 0x058BF300>0x05806F58 with > obj at 0x043F > F22C>,) [1,0,None] > Debugging interfaces not available - debugging is disabled.. > in <win32com.axscript.client.pyscript.PyScript instance at > 0x058BF300>._InvokeEx_-InitNew() [1,0,None] > in <win32com.axscript.client.pyscript.PyScript instance at > 0x058BF300>._InvokeEx_-AddNamedItem(u'application', 14) [1,0,None] > **************** ASSERTION FAILED ******************* The typeKind of > the object is unexpected in > <win32com.axscript.client.pyscript.PyScript instance at > 0x058BF300>._InvokeEx_-Close() [1,0,None] > > > Hopefully that means more to you than it does to me! FWIW, the implementation is all in python in the win32comext\axscript\client directory. Grepping for this message shows it as appearing in framework.py in the function GetSourceTypeInfo(). This function is attempting to locate the possible events for an item, but it is only expecting the typeinfo to be one of TKIND_COCLASS or TKIND_INTERFACE - sadly it doesn't report what was actually found, but you might be able to determine that as it is your typeinfo being examined. Assuming your objects don't actually have events, the simplest fix would be to just change: if typeKind not in [pythoncom.TKIND_COCLASS, pythoncom.TKIND_INTERFACE]: RaiseAssert(winerror.E_UNEXPECTED, "The typeKind of the object is unexpected") to if typeKind not in [pythoncom.TKIND_COCLASS, pythoncom.TKIND_INTERFACE]: return None [Sadly there is also a bug in that RaiseAssert function - it has the args wrong when creating the exception - it should read 'raise Exception(desc, scode)', hence the E_UNEXPECTED is coming out as E_FAIL - but that's not really a big deal...] Let me know if that works for you and I'll make that change for the next release. Cheers, Mark _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32