Help with conversion VB script to Python : COM objects

Roger Upole rupole at hotmail.com
Tue Jun 27 10:42:15 CEST 2006


<mitsura at skynet.be> wrote in message news:1151326097.306855.11880 at y41g2000cwy.googlegroups.com...
> Hi,
>
> I need to re-write a VB script into Python (because I really don't like
> VB).
>
> The VB script is used to create a Windows COM object.
> (I am more of Unix guy, so COM objects are a little bit alien for me).
>
> At a certain point in the VB script, I have the following line:
> objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList)
>
> Does anybody what the equivalent in Python would be?
> I tried:
> objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList() )
>
> but then I get the following error:
> "
> Traceback (most recent call last):
>  File "C:\Python24\MyProgs\FodFin\test.py", line 11, in ?
>    objPolTypes = objPmad.cvar(objPmad.GetPolicyTypeList() )
>  File "<COMObject PMAD.OvPmdPolicyManager>", line 2, in cvar
> pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 1)
> "
>
> I also tried :
> objPolTypes = objPmad.GetPolicyTypeList()
>
> this works but I end of with a list of COM object and have no clue how
> to query/use them or what methods are defined for those type of
> objects.
>
> Any help really appreciated.
>
> With kind regards,
>
> KRis
>

If the application has a typelib, you can use makepy to generate a wrapper
module that will show you the objects' methods and properties.
Otherwise, you'll have to depend on the documentation for the app.

       Roger




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---



More information about the Python-list mailing list