[python-win32] Python crash after win32com.client.CastTo?

Nathan Edwards nedwards at umiacs.umd.edu
Thu Mar 24 03:54:46 CET 2005


> Try passing explicit args for every arg, or substituting pythoncom.Missing
> instead of pythoncom.Empty.

Already tried the first (same result-immediate crash). Don't understand 
the second...

I've tried explicit "correct value and type" and "incorrect value but 
correct type" args for every arg, immediate crash in each case.

I've come across another strange behavior that I don't understand...this 
type library has another class that is the "blessed" way to get an 
object of the type I'm having trouble with. However, I can't get the 
interface object to instantiate:

# This CoClass is known by the name 'Analyst.FMANWiffFileControl.1'
class FMANWiffFileControl(CoClassBaseClass): # A CoClass
	# FMANWiffFileControl Class
	CLSID = IID('{A1A48EC4-98C6-11D1-A9F6-0060977F5C78}')
	coclass_sources = [
	]
	coclass_interfaces = [
		IFMANWiffFileControl,
	]
	default_interface = IFMANWiffFileControl

class IFMANWiffFileControl(DispatchBaseClass):
	"""IFMANWiffFileControl Interface"""
	CLSID = IID('{A1A48EC3-98C6-11D1-A9F6-0060977F5C78}')
	coclass_clsid = IID('{A1A48EC4-98C6-11D1-A9F6-0060977F5C78}')

	# Result is of type IFMANWiffFile
	def GetWiffFileObject(self, WiffFileName=defaultNamedNotOptArg, 
sample=defaultNamedNotOptArg):
		"""method GetWiffFileObject"""
		ret = self._oleobj_.InvokeTypes(1, LCID, 1, (9, 0), ((8, 1), (3, 
1)),WiffFileName, sample)
		if ret is not None:
			ret = Dispatch(ret, 'GetWiffFileObject', 
'{26E42183-9803-11D1-A9F6-0060977F5C78}', UnicodeToString=0)
		return ret

	_prop_map_get_ = {
	}
	_prop_map_put_ = {
	}

This all looks fine, but attempting to instantiate the interface:

 >>> from win32com.client import Dispatch
 >>> Dispatch('Analyst.FMANWiffFileControl.1')
...
com_error: (-2147467262, 'No such interface supported', None, None)
 >>> Dispatch('Analyst.FMANWiffFileControl')
...
com_error: (-2147467262, 'No such interface supported', None, None)
 >>> Dispatch('Analyst.IFMANWiffFileControl')
...
com_error: (-2147221005, 'Invalid class string', None, None)

Why does this CoClass get created with the .1 after it? And why can't I 
create an interface to the FMANWiffFileControl object?

Thanks,

nathan

-- 
Nathan Edwards, Ph.D.
Center for Bioinformatics and Computational Biology
3119 Agriculture/Life Sciences Surge Building #296
University of Maryland, College Park, MD 20742-3360
Phone: +1 301-405-9901
Email: nedwards at umiacs.umd.edu
WWWeb: http://www.umiacs.umd.edu/~nedwards



More information about the Python-win32 mailing list