win32com: get error 80004005 in attempt to use a pythom COM serve r

LArbilla at LArbilla at
Mon Aug 6 19:15:04 CEST 2001

I'm seriously stuck (2 days now) at my first attempt to use win32com to
write a com server in python.
I've search and read all I could find and I still don't see how to solve the
1) I wrote a simple COM server in python, it registers and I can see it in
PythonWin's COM Browser:
2) I tried to use it from VB:
	Dim theServer As Object
	Set theServer = CreateObject("Python.Rae")
   and got error -2147467259 (80004005) "Unexpected Python Error:
exceptions.ImportError: No module named raecom"
3) So, I decided to first test it from Python.
   The client calls the server's  __init__ (from win32com.client.Dispatch), 
   but the call fails with the same error (in python, it only shows
3) I tried:
	- putting all of the code in c:\program files\python  (where python
and win32com are installed)
		and it didn't make a difference
	- I also tried commenting out the line "_reg_class_spec", which has
the only reference to "raecom"
		and it didn't make a difference

I would appreciate any tips. I'm sure it is something simple.
Below is the code for the server, the client and the "trace".
Thanks a bunch!!
larbilla at

import win32com.server
import raeapimodule
import win32traceutil

class Rae:
	_public_methods_ = ['ConfigFromFile', 'Init']
	_public_attrs_ = ['projectName']
	_readonly_attrs_ = ['projectName']
	_reg_clsid_ = "{8680B790-875A-11d5-9A59-005004630197}"
	_reg_progid_ = "Python.Rae"
	_reg_desc_ = "Python COM RAE Wrapper"
	_reg_class_spec_ = "raecom.Rae"
#only for dual interfaces
#	_com_interfaces_ = ['IRae']
	def __init__(self):
		print " Rae.__init__ being called"
		self._pid = -1
		print " Rae.__init__ uno"
		self.projectName = ""
		print " Rae.__init__ dos"
		return 1
	def ConfigFromFile(self, fileName):
		print " Rae.ConfigFromFile being called"
		self._pid = raeapimodule.ConfigFromFile(fileName)
		if (self._pid > 0):
			self.projectName = fileName
		return self._pid
	def Init(self):
		print " Rae.Init being called"
		status = raeapimodule.Init(self._pid)
		return status

if __name__ == '__main__':
	import win32com.server.register


import win32com.client
print "start"
o = win32com.client.Dispatch("Python.Rae")
print "called dispatch"
print "called configfromfile"
print o.projectName


Registered: Python.Rae 
start  <--- this actually shows in the command line Rae.__init__ being called Rae.__init__ uno Rae.__init__ dos
Traceback (innermost last):
  File "", line 4, in ?
    o = win32com.client.Dispatch("Python.Rae")
  File "C:\Program Files\Python\win32com\client\", line 94, in
    dispatch, userName =
  File "C:\Program Files\Python\win32com\client\", line 80, in
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Program Files\Python\win32com\client\", line 71, in
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pywintypes.com_error: (-2147467259, 'Unspecified error', None, None)

More information about the Python-list mailing list