Python pythoncom.com_error() Examples

The following are 30 code examples of pythoncom.com_error(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pythoncom , or try the search function .
Example #1
Source File: policy.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def _CreateInstance_(self, clsid, reqIID):
    """Creates a new instance of a **wrapped** object

       This method looks up a "@win32com.server.policy.regSpec@" % clsid entry
       in the registry (using @DefaultPolicy@)
    """
    try:
      classSpec = win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT,
                                       regSpec % clsid)
    except win32api.error:
      raise error("The object is not correctly registered - %s key can not be read" % (regSpec % clsid))
    myob = call_func(classSpec)
    self._wrap_(myob)
    try:
      return pythoncom.WrapObject(self, reqIID)
    except pythoncom.com_error, (hr, desc, exc, arg):
      from win32com.util import IIDToInterfaceName
      desc = "The object '%r' was created, but does not support the " \
             "interface '%s'(%s): %s" \
             % (myob, IIDToInterfaceName(reqIID), reqIID, desc)
      raise pythoncom.com_error(hr, desc, exc, arg) 
Example #2
Source File: excelAddin.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def OnConnection(self, application, connectMode, addin, custom):
        print "OnConnection", application, connectMode, addin, custom
        try:
            self.appHostApp = application
            cbcMyBar = self.appHostApp.CommandBars.Add(Name="PythonBar", Position=constants.msoBarTop, MenuBar=constants.msoBarTypeNormal, Temporary=True)
            btnMyButton = cbcMyBar.Controls.Add(Type=constants.msoControlButton, Parameter="Greetings")
            btnMyButton=self.toolbarButton = DispatchWithEvents(btnMyButton, ButtonEvent)
            btnMyButton.Style = constants.msoButtonCaption
            btnMyButton.BeginGroup = True
            btnMyButton.Caption = "&Python"
            btnMyButton.TooltipText = "Python rules the World"
            btnMyButton.Width = "34"
            cbcMyBar.Visible = True
        except pythoncom.com_error, (hr, msg, exc, arg):
            print "The Excel call failed with code %d: %s" % (hr, msg)
            if exc is None:
                print "There is no extended error information"
            else:
                wcode, source, text, helpFile, helpId, scode = exc
                print "The source of the error is", source
                print "The error message is", text
                print "More info can be found in %s (id=%d)" % (helpFile, helpId) 
Example #3
Source File: gencache.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def GetModuleForProgID(progid):
	"""Get a Python module for a Program ID
	
	Given a Program ID, return a Python module which contains the
	class which wraps the COM object.
	
	Returns the Python module, or None if no module is available.
	
	Params
	progid -- A COM ProgramID or IID (eg, "Word.Application")
	"""
	try:
		iid = pywintypes.IID(progid)
	except pywintypes.com_error:
		return None
	return GetModuleForCLSID(iid) 
Example #4
Source File: error.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def ProcessAXScriptException(scriptingSite, debugManager, exceptionInstance):
	"""General function to handle any exception in AX code
	
	This function creates an instance of our IActiveScriptError interface, and
	gives it to the host, along with out exception class.  The host will
	likely call back on the IActiveScriptError interface to get the source text
	and other information not normally in COM exceptions.
	"""
#	traceback.print_exc()
	instance = IActiveScriptError()
	instance._SetExceptionInfo(exceptionInstance)
	gateway = win32com.server.util.wrap(instance, axscript.IID_IActiveScriptError)
	if debugManager:
		fCallOnError = debugManager.HandleRuntimeError()
		if not fCallOnError:
			return None
		
	try:
		result = scriptingSite.OnScriptError(gateway)
	except pythoncom.com_error, details:
		print "**OnScriptError failed:", details
		print "Exception description:'%s'" % (repr(exceptionInstance.description))
		print "Exception text:'%s'" % (repr(exceptionInstance.linetext))
		result = winerror.S_FALSE 
Example #5
Source File: gencache.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def MakeModuleForTypelib(typelibCLSID, lcid, major, minor, progressInstance = None, bGUIProgress = None, bForDemand = bForDemandDefault, bBuildHidden = 1):
	"""Generate support for a type library.
	
	Given the IID, LCID and version information for a type library, generate
	and import the necessary support files.
	
	Returns the Python module.  No exceptions are caught.

	Params
	typelibCLSID -- IID of the type library.
	major -- Integer major version.
	minor -- Integer minor version.
	lcid -- Integer LCID for the library.
	progressInstance -- Instance to use as progress indicator, or None to
	                    use the GUI progress bar.
	"""
	if bGUIProgress is not None:
		print "The 'bGuiProgress' param to 'MakeModuleForTypelib' is obsolete."

	import makepy
	try:
		makepy.GenerateFromTypeLibSpec( (typelibCLSID, lcid, major, minor), progressInstance=progressInstance, bForDemand = bForDemand, bBuildHidden = bBuildHidden)
	except pywintypes.com_error:
		return None
	return GetModuleForTypelib(typelibCLSID, lcid, major, minor) 
Example #6
Source File: gencache.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def MakeModuleForTypelibInterface(typelib_ob, progressInstance = None, bForDemand = bForDemandDefault, bBuildHidden = 1):
	"""Generate support for a type library.
	
	Given a PyITypeLib interface generate and import the necessary support files.  This is useful
	for getting makepy support for a typelibrary that is not registered - the caller can locate
	and load the type library itself, rather than relying on COM to find it.
	
	Returns the Python module.

	Params
	typelib_ob -- The type library itself
	progressInstance -- Instance to use as progress indicator, or None to
	                    use the GUI progress bar.
	"""
	import makepy
	try:
		makepy.GenerateFromTypeLibSpec( typelib_ob, progressInstance=progressInstance, bForDemand = bForDemandDefault, bBuildHidden = bBuildHidden)
	except pywintypes.com_error:
		return None
	tla = typelib_ob.GetLibAttr()
	guid = tla[0]
	lcid = tla[1]
	major = tla[3]
	minor = tla[4]
	return GetModuleForTypelib(guid, lcid, major, minor) 
Example #7
Source File: gencache.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def EnsureDispatch(prog_id, bForDemand = 1): # New fn, so we default the new demand feature to on!
	"""Given a COM prog_id, return an object that is using makepy support, building if necessary"""
	disp = win32com.client.Dispatch(prog_id)
	if not disp.__dict__.get("CLSID"): # Eeek - no makepy support - try and build it.
		try:
			ti = disp._oleobj_.GetTypeInfo()
			disp_clsid = ti.GetTypeAttr()[0]
			tlb, index = ti.GetContainingTypeLib()
			tla = tlb.GetLibAttr()
			mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], bForDemand=bForDemand)
			GetModuleForCLSID(disp_clsid)
			# Get the class from the module.
			import CLSIDToClass
			disp_class = CLSIDToClass.GetClass(str(disp_clsid))
			disp = disp_class(disp._oleobj_)
		except pythoncom.com_error:
			raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object")
	return disp 
Example #8
Source File: dynamic.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def Dispatch(IDispatch, userName = None, createClass = None, typeinfo = None, UnicodeToString=None, clsctx = pythoncom.CLSCTX_SERVER):
	assert UnicodeToString is None, "this is deprecated and will go away"
	IDispatch, userName = _GetGoodDispatchAndUserName(IDispatch,userName,clsctx)
	if createClass is None:
		createClass = CDispatch
	lazydata = None
	try:
		if typeinfo is None:
			typeinfo = IDispatch.GetTypeInfo()
		try:
			#try for a typecomp
			typecomp = typeinfo.GetTypeComp()
			lazydata = typeinfo, typecomp
		except pythoncom.com_error:
			pass
	except pythoncom.com_error:
		typeinfo = None
	olerepr = MakeOleRepr(IDispatch, typeinfo, lazydata)
	return createClass(IDispatch, olerepr, userName, lazydata=lazydata) 
Example #9
Source File: adb.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def CloseApp(self):
        traceenter("ClosingApp")
        self.reset()
        self.logicalbotframe = None
        if self.stackSnifferCookie is not None:
            try:
                self.debugApplication.RemoveStackFrameSniffer(self.stackSnifferCookie)

            except pythoncom.com_error:
                trace("*** Could not RemoveStackFrameSniffer %d" % (self.stackSnifferCookie))
        if self.stackSniffer:
            _wrap_remove(self.stackSniffer)
        self.stackSnifferCookie = self.stackSniffer = None

        if self.appEventConnection is not None:
            self.appEventConnection.Disconnect()
            self.appEventConnection = None
        self.debugApplication = None
        self.appDebugger = None
        if self.codeContainerProvider is not None:
            self.codeContainerProvider.Close()
            self.codeContainerProvider = None 
Example #10
Source File: genpy.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def _Build_CoClass(self, type_info_tuple):
    info, infotype, doc, attr = type_info_tuple
    # find the source and dispinterfaces for the coclass
    child_infos = []
    for j in range(attr[8]):
      flags = info.GetImplTypeFlags(j)
      try:
        refType = info.GetRefTypeInfo(info.GetRefTypeOfImplType(j))
      except pythoncom.com_error:
        # Can't load a dependent typelib?
        continue
      refAttr = refType.GetTypeAttr()
      child_infos.append( (info, refAttr.typekind, refType, refType.GetDocumentation(-1), refAttr, flags) )
      
    # Done generating children - now the CoClass itself.
    newItem = CoClassItem(info, attr, doc)
    return newItem, child_infos 
Example #11
Source File: policy.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def _build_typeinfos_(self):
    # Can only ever be one for now.
    tlb_guid = getattr(self._obj_, '_typelib_guid_', None)
    if tlb_guid is None:
      return []
    tlb_major, tlb_minor = getattr(self._obj_, '_typelib_version_', (1,0))
    tlb = pythoncom.LoadRegTypeLib(tlb_guid, tlb_major, tlb_minor)
    typecomp = tlb.GetTypeComp()
    # Not 100% sure what semantics we should use for the default interface.
    # Look for the first name in _com_interfaces_ that exists in the typelib.
    for iname in self._obj_._com_interfaces_:
      try:
        type_info, type_comp = typecomp.BindType(iname)
        if type_info is not None:
          return [type_info]
      except pythoncom.com_error:
        pass
    return [] 
Example #12
Source File: ocxserialtest.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def OnInitDialog(self):
		rc = dialog.Dialog.OnInitDialog(self)
		self.editwindow = self.GetDlgItem(132)
		self.editwindow.HookAllKeyStrokes(self.OnKey)

		self.olectl = MySerialControl(self)
		try:
			self.olectl.CreateControl("OCX",
			                          win32con.WS_TABSTOP | win32con.WS_VISIBLE,
			                          (7,43,500,300), self._obj_, 131)
		except win32ui.error:
			self.MessageBox("The Serial Control could not be created")
			self.olectl = None
			self.EndDialog(win32con.IDCANCEL)
		if self.olectl:			                        
			self.olectl.Settings = SERIAL_SETTINGS
			self.olectl.CommPort = SERIAL_PORT
			self.olectl.RThreshold = 1
			try:
				self.olectl.PortOpen = 1
			except pythoncom.com_error, details:
				print "Could not open the specified serial port - %s" % (details.excepinfo[2])
				self.EndDialog(win32con.IDCANCEL) 
Example #13
Source File: test.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def _DumpObject(ob, level = 0):
	prefix = "  " * level
	print "%s%s object: %s" % (prefix, ob.Class, ob.Name)
	# Do the directory object thing
	try:
		dir_ob = ADsGetObject(ob.ADsPath, IID_IDirectoryObject)
	except pythoncom.com_error:
		dir_ob = None
	if dir_ob is not None:
		info = dir_ob.GetObjectInformation()
		print "%s RDN='%s', ObjectDN='%s'" % (prefix, info.RDN, info.ObjectDN)
		# Create a list of names to fetch
		names = ["distinguishedName"]
		attrs = dir_ob.GetObjectAttributes(names)
		for attr in attrs:
			for val, typ in attr.Values:
				print "%s Attribute '%s' = %s" % (prefix, attr.AttrName, val)

	for child in ob:
		_DumpObject(child, level+1) 
Example #14
Source File: install.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def CreateISAPIFilter(filterParams, options):
    server = FindWebServer(options, filterParams.Server)
    _CallHook(filterParams, "PreInstall", options)
    try:
        filters = GetObject(server+"/Filters")
    except pythoncom.com_error, exc:
        # Brand new sites don't have the '/Filters' collection - create it.
        # Any errors other than 'not found' we shouldn't ignore.
        if winerror.HRESULT_FACILITY(exc.hresult) != winerror.FACILITY_WIN32 or \
           winerror.HRESULT_CODE(exc.hresult) != winerror.ERROR_PATH_NOT_FOUND:
            raise
        server_ob = GetObject(server)
        filters = server_ob.Create(_IIS_FILTERS, "Filters")
        filters.FilterLoadOrder = ""
        filters.SetInfo()

    # As for VirtualDir, delete an existing one. 
Example #15
Source File: testShell.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def testShellLink(self):
        desktop = str(shell.SHGetSpecialFolderPath(0, CSIDL_DESKTOP))
        num = 0
        shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
        persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile)
        names = [os.path.join(desktop, n) for n in os.listdir(desktop)]
        programs = str(shell.SHGetSpecialFolderPath(0, CSIDL_PROGRAMS))
        names.extend([os.path.join(programs, n) for n in os.listdir(programs)])
        for name in names:
            try:
                persistFile.Load(name,STGM_READ)
            except pythoncom.com_error:
                continue
            # Resolve is slow - avoid it for our tests.
            #shellLink.Resolve(0, shell.SLR_ANY_MATCH | shell.SLR_NO_UI)
            fname, findData = shellLink.GetPath(0)
            unc = shellLink.GetPath(shell.SLGP_UNCPRIORITY)[0]
            num += 1
        if num == 0:
            # This isn't a fatal error, but is unlikely.
            print "Could not find any links on your desktop or programs dir, which is unusual" 
Example #16
Source File: eventsFreeThreaded.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def TestExplorerEvents():
    iexplore = win32com.client.DispatchWithEvents(
        "InternetExplorer.Application", ExplorerEvents)

    thread = win32api.GetCurrentThreadId()
    print 'TestExplorerEvents created IE object on thread %d'%thread

    iexplore.Visible = 1
    try:
        iexplore.Navigate(win32api.GetFullPathName('..\\readme.htm'))
    except pythoncom.com_error, details:
        print "Warning - could not open the test HTML file", details

    # In this free-threaded example, we can simply wait until an event has 
    # been set - we will give it 2 seconds before giving up. 
Example #17
Source File: __init__.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def __WrapDispatch(dispatch, userName = None, resultCLSID = None, typeinfo = None, \
                  UnicodeToString=None, clsctx = pythoncom.CLSCTX_SERVER,
                  WrapperClass = None):
  """
    Helper function to return a makepy generated class for a CLSID if it exists,
    otherwise cope by using CDispatch.
  """
  assert UnicodeToString is None, "this is deprecated and will go away"
  if resultCLSID is None:
    try:
      typeinfo = dispatch.GetTypeInfo()
      if typeinfo is not None: # Some objects return NULL, some raise exceptions...
        resultCLSID = str(typeinfo.GetTypeAttr()[0])
    except (pythoncom.com_error, AttributeError):
      pass
  if resultCLSID is not None:
    import gencache
    # Attempt to load generated module support
    # This may load the module, and make it available
    klass = gencache.GetClassForCLSID(resultCLSID)
    if klass is not None:
      return klass(dispatch)

  # Return a "dynamic" object - best we can do!
  if WrapperClass is None: WrapperClass = CDispatch
  return dynamic.Dispatch(dispatch, userName, WrapperClass, typeinfo, clsctx=clsctx) 
Example #18
Source File: eventsApartmentThreaded.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def TestExplorerEvents():
    iexplore = win32com.client.DispatchWithEvents(
        "InternetExplorer.Application", ExplorerEvents)

    thread = win32api.GetCurrentThreadId()
    print 'TestExplorerEvents created IE object on thread %d'%thread

    iexplore.Visible = 1
    try:
        iexplore.Navigate(win32api.GetFullPathName('..\\readme.htm'))
    except pythoncom.com_error, details:
        print "Warning - could not open the test HTML file", details

    # Wait for the event to be signalled while pumping messages. 
Example #19
Source File: exception.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def IsCOMException(t = None):
	if t is None:
		t = sys.exc_info()[0]
	try:
		return issubclass(t, pythoncom.com_error)
	except TypeError: # 1.5 in -X mode?
		return t is pythoncon.com_error 
Example #20
Source File: connect.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def Advise(self, pUnk):
		# Creates a connection to the client.  Simply allocate a new cookie,
		# find the clients interface, and store it in a dictionary.
		try:
			interface = pUnk.QueryInterface(self._connect_interfaces_[0],pythoncom.IID_IDispatch)
		except pythoncom.com_error:
			raise Exception(scode=olectl.CONNECT_E_NOCONNECTION)
		self.cookieNo = self.cookieNo + 1
		self.connections[self.cookieNo] = interface
		return self.cookieNo 
Example #21
Source File: register.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def UnregisterClasses(*classes, **flags):
  quiet = 'quiet' in flags and flags['quiet']
  for cls in classes:
    clsid = cls._reg_clsid_
    progID = _get(cls, '_reg_progid_')
    verProgID = _get(cls, '_reg_verprogid_')
    customKeys = _get(cls, '_reg_remove_keys_')
    unregister_typelib = _get(cls, '_reg_typelib_filename_') is not None

    UnregisterServer(clsid, progID, verProgID, customKeys)
    if not quiet:
      print 'Unregistered:', progID or str(clsid)
    if unregister_typelib:
      tlb_guid = _get(cls, "_typelib_guid_")
      if tlb_guid is None:
        # I guess I could load the typelib, but they need the GUID anyway.
        print "Have typelib filename, but no GUID - can't unregister"
      else:
        major, minor = _get(cls, "_typelib_version_", (1,0))
        lcid = _get(cls, "_typelib_lcid_", 0)
        try:
          pythoncom.UnRegisterTypeLib(tlb_guid, major, minor, lcid)
          if not quiet:
            print 'Unregistered type library'
        except pythoncom.com_error:
          pass

  extra = flags.get('finalize_unregister')
  if extra:
    extra()
#
# Unregister info is for installers or external uninstallers.
# The WISE installer, for example firstly registers the COM server,
# then queries for the Unregister info, appending it to its
# install log.  Uninstalling the package will the uninstall the server 
Example #22
Source File: exception.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def __init__(self, description = None, scode = None,
				 source = None, helpfile = None, helpContext = None,
				 desc = None, hresult = None):
		"""Initialize an exception
		**Params**

		description -- A string description for the exception.
		scode -- An integer scode to be returned to the server, if necessary.
		The pythoncom framework defaults this to be DISP_E_EXCEPTION if not specified otherwise.
		source -- A string which identifies the source of the error.
		helpfile -- A string which points to a help file which contains details on the error.
		helpContext -- An integer context in the help file.
		desc -- A short-cut for description.
		hresult -- A short-cut for scode.
		"""

		# convert a WIN32 error into an HRESULT
		scode = scode or hresult
		if scode and scode != 1: # We dont want S_FALSE mapped!
			if scode >= -32768 and scode < 32768:
				# this is HRESULT_FROM_WIN32()
				scode = -2147024896 | (scode & 0x0000FFFF)
		self.scode = scode

		self.description = description or desc
		if scode==1 and not self.description:
			self.description = "S_FALSE"
		elif scode and not self.description:
			self.description = pythoncom.GetScodeString(scode)

		self.source = source
		self.helpfile = helpfile
		self.helpcontext = helpContext

		# todo - fill in the exception value
		pythoncom.com_error.__init__(self, scode, self.description, None, -1) 
Example #23
Source File: windows.py    From rekall with GNU General Public License v2.0 5 votes vote down vote up
def collect(self):
        # Needs to be called if using com from a thread.
        pythoncom.CoInitialize()

        wmi_obj = win32com.client.GetObject(self.plugin_args.baseobj)

        # This allows our WMI to do some extra things, in particular
        # it gives it access to find the executable path for all processes.
        wmi_obj.Security_.Privileges.AddAsString("SeDebugPrivilege")

        # Run query
        try:
            query_results = wmi_obj.ExecQuery(self.plugin_args.query)
        except pythoncom.com_error as e:
            raise plugin.PluginError(
                "Failed to run WMI query \'%s\' err was %s" % (
                    self.plugin_args.query, e))

        # Extract results from the returned COMObject and return dicts.
        try:
            for result in query_results:
                yield dict(Result=WmiResult(result))

        except pythoncom.com_error as e:
            raise plugin.PluginError(
                "WMI query data error on query \'%s\' err was %s" %
                (e, self.plugin_args.query)) 
Example #24
Source File: trybag.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def Read(self, propName, varType, errorLog):
    print "read: name=", propName, "type=", varType
    if propName not in self.data:
      if errorLog:
        hr = 0x80070057
        exc = pythoncom.com_error(0, "Bag.Read", "no such item", None, 0, hr)
        errorLog.AddError(propName, exc)
      raise exception.Exception(scode=hr)
    return self.data[propName] 
Example #25
Source File: test_exceptions.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def testStrangeArgsTooMany(self):
        try:
            raise pywintypes.com_error("foo", "bar", "you", "never", "kn", 0)
            self.fail("Expected exception")
        except pywintypes.com_error, exc:
            self.failUnlessEqual(exc.args[0], "foo")
            self.failUnlessEqual(exc.args[-1], 0)
            self.failUnlessEqual(exc.hresult, "foo")
            self.failUnlessEqual(exc.strerror, "bar")
            self.failUnlessEqual(exc.excepinfo, "you")
            self.failUnlessEqual(exc.argerror, "never") 
Example #26
Source File: test_exceptions.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def testStrangeArgsNotEnough(self):
        try:
            raise pywintypes.com_error("foo")
            self.fail("Expected exception")
        except pywintypes.com_error, exc:
            self.failUnlessEqual(exc.args[0], "foo")
            self.failUnlessEqual(exc.hresult, "foo")
            self.failUnlessEqual(exc.strerror, None)
            self.failUnlessEqual(exc.excepinfo, None)
            self.failUnlessEqual(exc.argerror, None) 
Example #27
Source File: test_exceptions.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def testStrangeArgsNone(self):
        try:
            raise pywintypes.com_error()
            self.fail("Expected exception")
        except pywintypes.com_error, exc:
            self.failUnlessEqual(exc.args, ())
            self.failUnlessEqual(exc.hresult, None)
            self.failUnlessEqual(exc.strerror, None)
            self.failUnlessEqual(exc.argerror, None)
            self.failUnlessEqual(exc.excepinfo, None) 
Example #28
Source File: test_exceptions.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def testBaseClass(self):
        exc = self._getException()
        self.failUnlessEqual(pywintypes.com_error.__bases__, (Exception,)) 
Example #29
Source File: test_exceptions.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def testIdentity(self):
        exc = self._getException()
        self.failUnless(exc.__class__ is pywintypes.com_error) 
Example #30
Source File: test_exceptions.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def testSimple(self):
        self.assertRaises(pythoncom.com_error, pythoncom.StgOpenStorage, "foo", None, 0)