win32con.client.constants error

Barry Newberger w5kh at arrl.net
Sun Apr 1 23:18:20 EDT 2007


I am working on a Outlook COM project. For some reason 
win32com.client.constants

quit working between runs of one of my test scripts.  It's supposed to 
acquire attributes for all constants defined in loaded COM servers 
through its __dicts__ attribute,and did for awhile

Now it is throwing an AttributeError:



PythonWin 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] 
on win32.

Portions Copyright 1994-2006 Mark Hammond - see 'Help/About PythonWin' 
for further copyright information.

Traceback (most recent call last):

  File 
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
 line 310, in RunScript

    exec codeObject in __main__.__dict__

  File "C:\Documents and 
Settings\bnewberg\Desktop\mail_script\mail_move_init_test.py", line 22, 
in ?

    msgFolderTypeConsts = {'Rcvd': constants.olFolderInbox, 'Sent': 
constants.olFolderSentMail}

  File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 
168, in __getattr__

    raise AttributeError, a

AttributeError: olFolderInbox



Code snippet:
from win32com.client import gencache, constan

[SNIP]

class MSOutlook(object):

    def __init__(self):

        try:

            self.oOutlookApp = 
gencache.EnsureDispatch("Outlook.Application")

            self.outlookFound = True

        except:

            print "MSOutlook: unable to load Outlook"

            self.outlookFound = False

            if not self.outlookFound: return

[SNIP]

# Outlook default folder constants

   msgFolderTypeConsts = {'Rcvd': constants.olFolderInbox, 'Sent': 
constants.olFolderSentMail}

   folderSet = [yr, mo, msgType] #  Used to loop over folder tree.



 I am running Python 2.4.4 and pywin32-210. I tried reinstalling pywin 
without success.

 Thanks,

 Barry Newberger



More information about the Python-list mailing list