I was looking for a python Zune(The windows media thing) api, when I looked at the COM browser in pythonwin. I found something called ZuneWmdu Type Library (1.0). I used makepy on that lib, it generated a file
9FE20C05-81CE-46D7-9C56-FD97A865BBB8x0x1x0.py
in
python 2.7.3\Lib\site-packages\win32com\gen_py
I have no idea what to pass into
win32com.client.gencache.EnsureDispatch('???')
I tried calling
win32com.client.gencache.EnsureDispatch('9FE20C0581CE46D79C56FD97A865BBB8')
Resulting in an exception (pywintypes.com_error)
(The x0x1x0 part of the .py file seemed unrelated)
I tried the same with
win32com.client.gencache.GetModuleForCLSID('9FE20C05-81CE-46D7-9C56-FD97A865BBB8')
and
win32com.client.gencache.GetModuleForProgID('9FE20C0581CE46D79C56FD97A865BBB8')
Both returning None. I'm stuck here, I need to either find what the library is called (for itunes, you'd call:
win32com.client.gencache.EnsureDispatch('iTunes Application')
for example) or how to call the module with the GUID
Or even someone to tell me that I'm doing something completely wrong.
The name of the CoClass can be found in the comments of the generated file (where they are based on the information from pythoncom.ProgIDFromCLSID
).
I don't have Zune but, if, for instance I run
win32com.client.gencache.EnsureModule('{420B2830-E718-11CF-893D-00A0C9054228}', 0, 1, 0)
this will generate a file called 420B2830-E718-11CF-893D-00A0C9054228x0x1x0.py
from which I can dig out the relevant names:
C:\Users\username\AppData\Local\Temp\gen_py\3.6>grep 'known by' *.py
420B2830-E718-11CF-893D-00A0C9054228x0x1x0.py:# This CoClass is known by the name 'Scripting.Dictionary'
420B2830-E718-11CF-893D-00A0C9054228x0x1x0.py:# This CoClass is known by the name 'Scripting.Encoder'
420B2830-E718-11CF-893D-00A0C9054228x0x1x0.py:# This CoClass is known by the name 'Scripting.FileSystemObject'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With