[python-win32] comtypes.server.register is case sensitive to filenames, see registry PythonClass.

jeffwelch at earthlink.net jeffwelch at earthlink.net
Thu Apr 19 15:32:05 CEST 2012


I was having intermittent problems creating a Python COM object that I am using as a test/learning exercise. What I finally noticed was that when I was command line registering the object I was not consistent in typing the name of the python file.


Executing the DOS command line:
    python TestMsgBox.py -regserver
Yields the following registry entry:
    HKEY_CLASSES_ROOT\CLSID\{a4c0208f-8888-11e1-ac67-b8ac6f92cf9d}\InprocServer32 
        PythonClass = "TestMsgBox.TestMsgBox"


Executing the DOS command line:
    python TestMsgBox.py -regserver
Yields the following registry entry:
    HKEY_CLASSES_ROOT\CLSID\{a4c0208f-8888-11e1-ac67-b8ac6f92cf9d}\InprocServer32 
        PythonClass = "testmsgbox.TestMsgBox"


I created the smallest sample I could to reproduce it. 

    import comtypes

    class TestMsgBox( comtypes.IUnknown ):
        _case_insensitive_ = True
        _reg_threading_ = "Both"
        _reg_progid_ = "TestMsgBoxLib.TestMsgBox"
        _reg_desc_ = "MessageBox sample for testing"
        _reg_clsctx_ = comtypes.CLSCTX_INPROC_SERVER | comtypes.CLSCTX_LOCAL_SERVER
        _reg_clsid_ = "{a4c0208f-8888-11e1-ac67-b8ac6f92cf9d}"

    if __name__ == "__main__":
        from comtypes.server.register import UseCommandLine
        UseCommandLine(TestMsgBox)

I don't know if this was intended behavior but I had not seen it documented.


More information about the python-win32 mailing list