[python-win32] pywintypes.com_error: (-2147467259, 'Unspecified error', None, None)

Blair, Colin S Colin.Blair at GDIT.com
Tue Mar 8 14:06:18 EST 2016


All,

Please assist me with this error:

Traceback (most recent call last):
  
    print msg.Body
  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 466, in 
    __getattr__
    return self._ApplyTypes_(*args)
  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 459, in
     _ApplyTypes_self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
    pywintypes.com_error: (-2147467259, 'Unspecified error', None, None)


I have a script that worked fine on a Windows 7 64Bit system. It broke when we upgraded to Windows 8 64bit. I am using python 2.7 32bit and pywin32-220.win32-py2.7.

The script iterates through messages and parses the msg body content.

I am able to access other properties of the message like Mailitem.Subject. Here are some of the properties I am no longer able to access:

.Body
. To 
.SenderName
.SenderEmailAddress


Here is a test script I used to produce this error:

import win32com.client

oApp = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

def getFolder(obj, name):
    for folder in obj:
        if folder.Name == name:
            return folder

inbox = getFolder(getFolder(oApp.Folders,"EMBOX").Folders,"Inbox")

for msg in inbox.Items:
    print msg.Body


Thank you for any assistance you can provide.
Colin


More information about the python-win32 mailing list