MaxDomeII - Python error (pywintypes.com_error) in trying to establish a connection

Discussion in 'Scripting and Programming' started by SBW, Apr 29, 2018.

  1. SBW

    SBW Standard User

    Joined:
    Apr 27, 2018
    Messages:
    4
    Location:
    George Mason University
    Hello,

    I am in the beginning stages of creating some Python code to control a telescope and dome. I am using MaxDomeII from Diffraction Limited as the dome driver. In the python code, I have:

    import win32com.client
    from win32com.client import Dispatch
    dome = win32com.client.Dispatch("MaxDome")

    I am using "MaxDome" inside the parenthesis because I see a dll file called MaxDome.dll that is saved at C:\Program Files (x86)\Common Files\ASCOM\Dome, so I think this is the appropriate driver file that I need to use.

    For reference, I am currently able to control the telescope using the following similar command without any issues: telescope = win32com.client.Dispatch("ASCOM.SoftwareBisque.Telescope")

    However, when I include the above line for the dome, I get two instances of a pywintypes.com_error that both reference an Invalid class string. The exact error is pasted below.

    >>> Beginning of Error message
    C:\telescope>python telescope.py
    Traceback (most recent call last):
    File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
    pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "master_guiding_radec_working.py", line 22, in <module>
    dome = win32com.client.Dispatch("MaxDome")
    File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
    File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
    File "C:\Users\Admin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
    pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
    >>> End of Error message

    I've done some online searching relating to this error message, and see potential solutions as adding particular values to the Windows Registry or trying to execute a makepy.py file. However, I'm not finding anything that suggests a concrete path forward. If anyone has experience with this type of issue and its resolution, please let me know.

    Thanks!
    Scott
     
  2. Colin Haig

    Colin Haig Cyanogen Customer

    Joined:
    Oct 27, 2014
    Messages:
    1,405
    Scott, I'm just another customer.
    Have a look at the ASCOM Yahoo Group (mentioned on the ASCOM site) and see if you can get a bit of guidance for the correct way to access all ASCOM devices.
     
  3. SBW

    SBW Standard User

    Joined:
    Apr 27, 2018
    Messages:
    4
    Location:
    George Mason University
    Thanks so much, Colin! I joined the ASCOM Yahoo Group as you mentioned and someone directed me to the ASCOM Profile Explorer menu, which showed me all the driver names I need and solved my issue. Appreciate your help!
     

Share This Page