[python-win32] Using win32com Constants

John Machin sjmachin at lexicon.net
Sat Feb 18 01:38:56 CET 2006


On 18/02/2006 11:25 AM, Dan Glassman wrote:
> David Carter wrote:
> 
>>>-----Original Message-----
>>>From: Robert Brewer [mailto:fumanchu at amor.org] 
>>>Sent: Friday, February 17, 2006 4:11 PM
>>>To: David Carter; python-win32 at python.org
>>>Subject: RE: [python-win32] Using win32com Constants
>>>
>>>
>>>David Carter wrote:
>>>
>>>
>>>>Why is it that when I want to use a win32COM constant such as 
>>>>acViewNormal in an MS Access COM automation session I find I
>>>>have to use some convoluted thing like:
>>>>
>>>>	ComConstants = 
>>>>win32com.client.constants.__dict__["__dicts__"][0]
>>>>	viewtype = ComConstants['acViewNormal']
>>>>
>>>>Am I missing something obvious? 
>>>
>>>Are you calling Dispatch before referencing the constants?
>>>
>>>http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/pywin32
> 
>  >
> 
>>Yes, -those- constants work fine. They're the application specific constants
>>that require the convolution.
> 
> 
> He wasn't suggesting that Dispatch wasn't working, but rather pointing out 
> that the constants don't work until *after* you've called Dispatch.
> 
> The way to use the constants (after calling Dispatch) is like this:
> 
>  >>> win32com.client.constants.acViewNormal
> 
> If that's not working, then I'd say there's nothing *too* obvious that you're 
> missing.  You've obviously run makepy, otherwise even the convolution wouldn't 
> work...
> 

David, Forget your convolvulus; show us a small complete runnable piece 
of code that tries to do what you expect/want, but fails.
Cheers,
John



More information about the Python-win32 mailing list