win32com.client (Howto edit Contacts in Outlook)

Bill Davy Bill at SynectixLtd.com
Sat Jul 12 14:36:16 CEST 2008


"Tim Golden" <mail at timgolden.me.uk> wrote in message 
news:mailman.332.1215788687.20628.python-list at python.org...
> Bill Davy wrote:
>> Traceback (most recent call last):
>>   File "H:/Personal/OutlookIF1/t2.py", line 18, in <module>
>>     outlook = win32com.client.gencache.EnsureDispatch 
>> ("Outlook.Application")
>>   File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
>> 536, in EnsureDispatch
>>     mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], 
>> bForDemand=bForDemand)
>>   File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
>> 393, in EnsureModule
>>     module = GetModuleForTypelib(typelibCLSID, lcid, major, minor)
>>   File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
>> 262, in GetModuleForTypelib
>>     AddModuleToCache(typelibCLSID, lcid, major, minor)
>>   File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
>> 554, in AddModuleToCache
>>     dict = mod.CLSIDToClassMap
>> AttributeError: 'module' object has no attribute 'CLSIDToClassMap'
>
>
> Just in case, could you delete the contents of your gen_py
> directory (probably in %TEMP%\gen_py)
>
> TJG



OK, Put the following ahead with the following results.

TempDir = os.getenv("TEMP");
WorkDir = TempDir + '\\gen_py'
print WorkDir
try:
  os.rmdir(WorkDir);
except  WindowsError, detail:
  print "Ignoring Windows error: ", detail

...

Result:


C:\DOCUME~1\Bill\LOCALS~1\Temp\gen_py
Ignoring Windows error:  [Error 2] The system cannot find the file 
specified: 'C:\\DOCUME~1\\Bill\\LOCALS~1\\Temp\\gen_py'

Traceback (most recent call last):
  File "H:\Personal\OutlookIF1\t2.py", line 26, in <module>
    outlook = win32com.client.gencache.EnsureDispatch 
("Outlook.Application")
  File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
536, in EnsureDispatch
    mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], 
bForDemand=bForDemand)
  File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
393, in EnsureModule
    module = GetModuleForTypelib(typelibCLSID, lcid, major, minor)
  File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
262, in GetModuleForTypelib
    AddModuleToCache(typelibCLSID, lcid, major, minor)
  File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 
554, in AddModuleToCache
    dict = mod.CLSIDToClassMap
AttributeError: 'module' object has no attribute 'CLSIDToClassMap'
>>>

So, although that directory did exist, it does not now (even after the 
program has run).

Any other ideas?

But many thnaks,
    Bill 





More information about the Python-list mailing list