Win32 COM question

Michael Kelly mkelly2002NOSPAM at
Sat Nov 17 17:50:00 CET 2001

Hi all.  I've just started trying out python and I have
a question about how it is to use an InProcess
COM server with it.  As example I have a COM
dll that does .ini file stuff that has a dual interface
and a type library.  In VB I have to make sure
it's selected in References then I can just do
something like:

Dim IniObj As New ComIniFile
  Set IniObj = CreateObject("IniLib.ComIniFile")
  IniObj.FileName = App.Path & "\ComIniFileTest.ini"
  IniObj.ReadSections MyStrings

Following the python quick start tips for COM
I installed the Win32all with PythonWin
and tried this:

import win32com.client
o = win32com.client.Dispatch("IniLib.ComIniFile")
o.FileName = "C:\Windows\Temp\TryIni.ini"
o.WriteString("StringSection", "Key", "SectionIsPun")

And I get error messages to the effect that module
types cannot be executed so it leads me to wonder
if this only works for OleAutomation .exe programs
such as MS Word or can you really use COM
.dlls and ActiveX controls??




"I don't want to belong to any club that would have me as a member."
    -- Groucho Marx

More information about the Python-list mailing list