[python-win32] Re: Constants quit working under Python 2.5

Roger Upole rwupole at msn.com
Wed Apr 11 08:41:31 CEST 2007


<kc106_2005-pywin32 at yahoo.com> wrote in message news:877431.58061.qm at web51412.mail.re2.yahoo.com...
>> > Hi list,
>> >
>> > I upgraded to Python 2.5 for evaluation and testing.
>> After installing the pywin32-210.win32-py2.5.exe, I found that the
>> > constants module doesn't work.  For example, this code fails:
>> >
>> >   from win32com.client import Dispatch, constants
>> >
>> >   print constants.xlDown
>> >
>> > I re-execute makepy.py and selected "Microsoft Office 10.0 Object
>> > Library (2.2)" but the problem persists.
>> >
>> > What should I do?
>> >
>> > Thanks,
>> >
>> > --
>> > John Henry
>>
>> xlDown appears to be in the Excel object library rather than
>> the Office object library.
>>
>>        hth
>>            Roger
>>
>>
>>
>
> Thanks for the reply.
>
> That's the one I've been using before the migration to 2.5.  I went back and tried both Microsoft Excel 10.0 (1.4) and 5.0 
> (1.0) Object Library and the failures are the same.
>

Try clearing out your gen_py folder and starting from scratch.
The below works for me with 2.5.

>>> import win32com.client
>>> xl=win32com.client.gencache.EnsureDispatch('Excel.Application',0)
>>> print win32com.client.constants.xlDown
-4121
>>>

           Roger



More information about the Python-win32 mailing list