Prev: python bijection
Next: python and netezza
From: John Bokma on 28 Nov 2009 18:25 News123 <news123(a)free.fr> wrote: > MRAB wrote: >> News123 wrote: >>> r wrote: >>>> more *maybe useful dump? >>>> >>>>>>> for i in dev.Items: >>>> for p in i.Properties: >>>> if not p.IsReadOnly: >>>> print p.Name, '->', p.Value [..] > The main question is the correct python method to change the property > > prop = 300 # doesn't work as it just replaces the property with an > integer wild guess, but how about p.Value = 300 ? John
From: News123 on 28 Nov 2009 20:14
Hi John, John Bokma wrote: > News123 <news123(a)free.fr> wrote: > >> MRAB wrote: >>> News123 wrote: >>>> r wrote: >>>>> more *maybe useful dump? >>>>> >>>>>>>> for i in dev.Items: >>>>> for p in i.Properties: >>>>> if not p.IsReadOnly: >>>>> print p.Name, '->', p.Value > > [..] > >> The main question is the correct python method to change the property >> >> prop = 300 # doesn't work as it just replaces the property with an >> integer > > wild guess, but how about p.Value = 300 ? > > John Wild and good guess indeed. p.Value = 300 is working. Finally I can do WIA scans and set the parameters. How could I have found this out without guessing? Or phrased differently: What would be the correct way to find out what can be done with variables returned by win32com.client s. I tried dir(prop) prop.__doc__ type(prop) and got ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_'] The dynamic class used as a last resort. The purpose of this overriding of dynamic.CDispatch is to perpetuate the policy of using the makepy generated wrapper Python class instead of dynamic.CDispatch if/when possible. and T <type 'instance'> I'd like to avoid wild guessing when being confronted with another win32.com object. Thanks again N |