[python-win32] Converting VB COM register program to Python
r c
chlo.prog at gmail.com
Thu Oct 4 20:36:50 CEST 2007
On 10/3/07, Tim Roberts <timr at probo.com> wrote:
>
> r c wrote:
> >
> > >In this case, where an indexed property had both a "Get" and a
> "Let"
> > >handler, the Python COM stuff generates a "Value" function for
> > the "Get"
> > >part, and a "SetValue" function for the "Let" part. >
> > >
> > >So, you want:
> > > objCOMAdminCatalogObject.SetValue("ID", AppID) >
> > >
> > >--
> > >Tim Roberts, timr at probo.com <mailto:timr at probo.com>
> > > Providenza & Boekelheide, Inc.
> >
> > When I try SetValue I get:
> >
> >
> >
> > Traceback (most recent call last):
> >
> > _File
> >
> "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py",
> > line 74, in <module>_
> >
> > CreateApplication()
> >
> > _File
> >
> "C:\programming\python\dev\src\FullInstallScripts\COMObjectFullInstall.py",
> > line 21, in CreateApplication_
> >
> > objCOMAdminCatalogObject.SetValue("ID", AppID)
> >
> > _File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line
> > 496, in __getattr___
> >
> > raise AttributeError, "%s.%s" % (self._username_, attr)
> >
> > AttributeError: Add.SetValue
> >
>
> Not sure what to tell you. This exact script runs correctly for me:
>
> import win32com.client
>
> objCOMAdminCatalog =
> win32com.client.Dispatch("COMAdmin.COMAdminCatalog")
> objApplications = objCOMAdminCatalog.GetCollection ("Applications")
> objCOMAdminCatalogObject = objApplications.Add()
> AppID = objCOMAdminCatalogObject.Value("ID")
> print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning
> the random ID
> objCOMAdminCatalogObject.SetValue("ID",AppID)
>
> Have you run "makepy" on this type lib?
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
Perfect! Adding the makepy to my script allowed me to call the SetValue
method:
win32com.client.gencache.EnsureModule(pywintypes.IID(*
'{F618C513-DFB8-11D1-A2CF-00805FC79235}'*), 0x0, 1, 0)
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20071004/f9ba6218/attachment.htm
More information about the python-win32
mailing list