comtypes
comtypes copied to clipboard
Generated Code with Quotation Marks
I have a program that I am trying to link to called ProMax
I run
from comtypes.client import CreateObject
CreateObject("ProMax.ProMax")
I get an error
File "C:\Users\rlarson\Anaconda3\envs\hub_opt\lib\site-packages\comtypes\gen\_00021A98_0000_0000_C000_000000000046_0_4_16.py", line 6304
"""A running instance of Visio. ProgId: "Visio.Application""""
^
SyntaxError: unterminated string literal (detected at line 6304)
Because of the docstring in the description of the of the class having quotes around it
class Application(CoClass):
"""A running instance of Visio. ProgId: "Visio.Application""""
^ ^
_reg_clsid_ = GUID('{00021A20-0000-0000-C000-000000000046}')
_idlflags_ = []
_typelib_path_ = typelib_path
_reg_typelib_ = ('{00021A98-0000-0000-C000-000000000046}', 4, 16)
The code generation fails because this becomes not valid python.
Found #336 after submitting
1.1.14 is out. Please try.
This is fixed with 1.1.14 The below example causes the Visio connections to be built and was failing.
Python 3.10.4 | packaged by conda-forge | (main, Mar 30 2022, 08:38:02) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from comtypes.client import CreateObject
>>> CreateObject("ProMax.ProMax")
<POINTER(_ProMax) ptr=0x1c3281e5ae0 at 1c354177c40>
>>>