[python-win32] com_error: Object is not connected to server
Michael Katz-Hyman
mkatshym+pythonwin32 at gmail.com
Mon Mar 20 17:22:36 CET 2006
I get the following error when trying to thread an object that uses a COM
connection to outlook. I tried re-Dispatching the object before accessing
it again but to now avail, ideas?
error:
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 444, in __bootstrap
self.run()
File "c:\documents and settings\mkatzhyman\my
documents\email\MainPanel.py", line 19, in run
foundEmails = self.oc.findEmail(self.email)
File "c:\documents and settings\mkatzhyman\my
documents\email\OutlookConnection.py", line 51, in findEmail
dlistCount = dlist.MemberCount
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line
496, in __getattr__
if d is not None: return getattr(d, attr)
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line
455, in __getattr__
return self._ApplyTypes_(*args)
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line
446, in _ApplyTypes_
return self._get_good_object_(
com_error: (-2147220995, 'Object is not connected to server', None, None)
function that is callled:
def findEmail(self,em): # call with the email, or name
## Re-connect to server
pythoncom.CoInitialize()
self.myOlApp = win32com.client.dynamic.Dispatch("Outlook.Application
")
self.myOlApp.Session.Logon()
self.myNameSpace = self.myOlApp.GetNamespace("MAPI")
founddlists = []
dlist = self.myOlApp.CreateItem(
win32com.client.constants.olDistributionListItem)
for dl in self.ListOfDLs.keys():
dlist = self.ListOfDLs[dl]
dlistCount = dlist.MemberCount
#print dlistCount
for a in range(1,dlistCount+1):
tmpRecip = dlist.GetMember(a)
name = tmpRecip.Name
address = tmpRecip.Address
if (name.find(em)>=0) or (address.find(em)>=0):
rdl = [name,address,dl]
founddlists.append(rdl)
return founddlists
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060320/965805b2/attachment.html
More information about the Python-win32
mailing list