Issue Connecting to Document Manager with COM

I am attempting to connect to the Document Manager API via the COM interface using Python. For some reason, I keep getting an error -2147467262, 'No such interface supported'. I've tried troubleshooting everything I can, but I've run out of ideas. Any input on how to proceed or what I may be doing wrong? I've got SolidWorks 2025 installed and functioning, so I believe that everything should already be installed and registered to run Document Manager.

Rather than try to list out in detail everything that I've tried, I've got a short Python script that walks through everything that I've checked so far. In addition to what's listed in the script, I opened the DLL found by the script below using Dependency Walker and verified that there are no missing dependencies (e.g. the VS C++ redistributable), I re-registered the DLL, I installed the latest C++ redistributable and verified the the 2014 version is installed (which is what I believe is required).

Here's the script:

import sys
import os
import struct
import platform
import winreg
import pythoncom
import win32com.client
from mytools import solidworks  # for the API key

API_KEY = solidworks.docmanager_credentials().api_key

ProgID = r'SwDocumentMgr.SwDMClassFactory'

def is_64bit_dll(path):
    with open(path, 'rb') as f:
        f.seek(0x3C)
        pe_offset = struct.unpack('<I', f.read(4))[0]
        f.seek(pe_offset + 0x18)
        magic = struct.unpack('<H', f.read(2))[0]
        return magic == 0x20b  # 0x20b = PE32+ (64-bit), 0x10b = PE32 (32-bit)

def get_dm_dll_path():
    try:
        # Open the ProgID
        key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, f"{ProgID}\\\\CLSID")
        clsid = winreg.QueryValue(key, None)
        winreg.CloseKey(key)

        # Now look up the InprocServer32 path under the CLSID
        key_path = fr"CLSID\\{clsid}\\InprocServer32"
        key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_path)
        dll_path = winreg.QueryValue(key, None)
        winreg.CloseKey(key)

        return dll_path
    except FileNotFoundError:
        return None

# Check system architecture
print(f"System architecture: {platform.architecture()[0]}")
print(f"Python version: {platform.python_version()}")
print(f"OS Info: {platform.platform(aliased=True)}")

# Check DM DLL path
dll_path = get_dm_dll_path()
if dll_path is not None and os.path.exists(dll_path):
    print(f"DocManager DLL exists: {dll_path}")
else:
    print(f"DocManager DLL NOT FOUND: {dll_path}")

# Check DLL bitness
print(f"The DLL {'is' if is_64bit_dll(dll_path) else 'is not'} a 64-bit DLL")

# Check registry ProgID
try:
    key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, ProgID)
    default_val = winreg.QueryValue(key, None)
    print(f"COM ProgID registered: {default_val}")
    winreg.CloseKey(key)
except FileNotFoundError:
    print(f"COM ProgID {ProgID} not found in registry!")

# COM initialization
try:
    pythoncom.CoInitialize()
    try:
        factory = win32com.client.gencache.EnsureDispatch(ProgID) # pyright: ignore[reportAttributeAccessIssue]
    except Exception as e:
        print(f'Primary factory initialization failed: {e}')
        factory = win32com.client.Dispatch(ProgID)
        print('Used fallback initialization')
    print("Factory created successfully.")
except Exception as e:
    print("Error creating factory:", e)

# Try to get DM Application
try:
    dm_app = factory.GetApplication(API_KEY) # pyright: ignore[reportPossiblyUnboundVariable]
    print("Document Manager application initialized successfully:", dm_app)
except Exception as e:
    print("Error initializing Document Manager application:", e)

And here's the output I am getting:

System architecture: 64bit
Python version: 3.13.3
OS Info: Windows-11-10.0.26200-SP0
DocManager DLL exists: C:\\Program Files\\Common Files\\SOLIDWORKS Shared\\SwDocumentMgr.dll
The DLL is a 64-bit DLL
COM ProgID registered: SwDMClassFactory Class
Primary factory initialization failed: (-2147467262, 'No such interface supported', None, None)
Error creating factory: (-2147467262, 'No such interface supported', None, None)
Error initializing Document Manager application: name 'factory' is not defined