471,313 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,313 software developers and data experts.

win32com COMAdminCatalogObject Value method

rc
I'm trying to convert VB code that registers COM+ components to
Python. However, I'm unable to set values on COMAdminCatalogObject
using the Value() method, it seems to think I'm trying to call the get
method.

VB Code:
Dim cat As COMAdminCatalog
Set cat = New COMAdminCatalog
Dim apps As COMAdminCatalogCollection
Set apps = cat.GetCollection("Applications")
Dim app As COMAdminCatalogObject
Set app = apps.Add
app.Value("ID") = AppID
Python Code:
objCOMAdminCatalog =
win32com.client.Dispatch("COMAdmin.COMAdminCatalog ")
objApplications = objCOMAdminCatalog.GetCollection("Applications")
objCOMAdminCatalogObject = objApplications.Add()
print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning
the random ID
# app.Value("ID") = AppID # SyntaxError: can't assign to function call
objCOMAdminCatalogObject.Value("ID", AppID) #Exception thrown

Returns the following error:
TypeError: Value() takes at most 2 arguments (3 given)

Oct 1 '07 #1
4 2259

rc wrote:
I'm trying to convert VB code that registers COM+ components to
Python. However, I'm unable to set values on COMAdminCatalogObject
using the Value() method, it seems to think I'm trying to call the get
method.

VB Code:
Dim cat As COMAdminCatalog
Set cat = New COMAdminCatalog
Dim apps As COMAdminCatalogCollection
Set apps = cat.GetCollection("Applications")
Dim app As COMAdminCatalogObject
Set app = apps.Add
app.Value("ID") = AppID
Python Code:
objCOMAdminCatalog =
win32com.client.Dispatch("COMAdmin.COMAdminCatalog ")
objApplications = objCOMAdminCatalog.GetCollection("Applications")
objCOMAdminCatalogObject = objApplications.Add()
print "ID", objCOMAdminCatalogObject.Value("ID") #This is returning
the random ID
# app.Value("ID") = AppID # SyntaxError: can't assign to function call
objCOMAdminCatalogObject.Value("ID", AppID) #Exception thrown

Returns the following error:
TypeError: Value() takes at most 2 arguments (3 given)
Try objCOMAdminCatalogObject.SetValue("ID", AppID).

Roger
Oct 1 '07 #2
rc
Try objCOMAdminCatalogObject.SetValue("ID", AppID).
>
Roger- Hide quoted text -

- Show quoted text -
When I try that I get exception:
AttributeError: Add.SetValue

I think the only valid methods are: Key(), Name(), Valid() and Value()

The thing I'm most confused about is that it seems to be getting into
the __getattr__ method, not the set, here's the whole error:
Traceback (most recent call last):
File "C:\programming\python\dev\src\FullInstallScri pts
\COMObjectFullInstall.py", line 74, in <module>
CreateApplication()
File "C:\programming\python\dev\src\FullInstallScri pts
\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

Oct 2 '07 #3
En Tue, 02 Oct 2007 12:12:09 -0300, rc <ch*******@gmail.comescribi�:
>Try objCOMAdminCatalogObject.SetValue("ID", AppID).
When I try that I get exception:
AttributeError: Add.SetValue
I think you would get more help asking in py**********@python.org

--
Gabriel Genellina

Oct 3 '07 #4
rc
On Oct 2, 11:11 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
En Tue, 02 Oct 2007 12:12:09 -0300, rc <chlo.p...@gmail.comescribi?:
Try objCOMAdminCatalogObject.SetValue("ID", AppID).
When I try that I get exception:
AttributeError: Add.SetValue

I think you would get more help asking in python-wi...@python.org

--
Gabriel Genellina
Thank you, python-win32 was able to help.
makepy needed to be run on the COM object allowing SetValue to be
called:
win32com.client.gencache.EnsureModule(pywintypes.I ID('{F618C513-
DFB8-11D1-A2CF-00805FC79235}'), 0x0, 1, 0)

Oct 4 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by kenchanningphd | last post: by
5 posts views Thread by Chris | last post: by
1 post views Thread by koia | last post: by
2 posts views Thread by ago | last post: by
2 posts views Thread by cfriedalek | last post: by
1 post views Thread by Ransom | last post: by
4 posts views Thread by mirandacascade | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.