I&#39;ve been using win32com.client to work with IE via COM, but recently had a need to start using comtypes.client because it provides a better wrapper for IE. <br>However, when I want to grab an existing IE using comtypes.client.GetActiveObject() the result is always the same as illustrated below<br>
<br><font size="1"><span style="font-family: courier new,monospace;">H:\devel\workspace\web\src&gt;python</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">win32</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&gt;&gt;&gt; import comtypes.client</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt; ie = comtypes.client.CreateObject(&#39;InternetExplorer.Application&#39;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&gt;&gt;&gt; ie.visible = True</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt; ie.__clsid</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&#39;{0002DF01-0000-0000-C000-000000000046}&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt; ie._iid_</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">GUID(&quot;{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt; newie = comtypes.client.GetActiveObject(&#39;InternetExplorer.Application&#39;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Traceback (most recent call last):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; File &quot;c:\python25\lib\site-packages\comtypes\client\__init__.py&quot;, line 164, in</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;GetActiveObject</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; obj = comtypes.GetActiveObject(clsid, interface=interface)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; File &quot;C:\Python25\Lib\site-packages\comtypes\__init__.py&quot;, line 990, in GetAct</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">iveObject</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; oledll.oleaut32.GetActiveObject(byref(clsid), None, byref(p))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; File &quot;\loewis\25\python\Modules\_ctypes\callproc.c&quot;, line 757, in GetResult</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">WindowsError: [Error -2147221021] Operation unavailable</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&gt;&gt;&gt; newie = comtypes.client.GetActiveObject(ie.__clsid)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Traceback (most recent call last):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; File &quot;c:\python25\lib\site-packages\comtypes\client\__init__.py&quot;, line 164, in</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;GetActiveObject</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; obj = comtypes.GetActiveObject(clsid, interface=interface)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; File &quot;C:\Python25\Lib\site-packages\comtypes\__init__.py&quot;, line 990, in GetAct</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">iveObject</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; oledll.oleaut32.GetActiveObject(byref(clsid), None, byref(p))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; File &quot;\loewis\25\python\Modules\_ctypes\callproc.c&quot;, line 757, in GetResult</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">WindowsError: [Error -2147221021] Operation unavailable</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&gt;&gt;&gt;</span></font><br>
<br>Has anyone got any bright ideas on how to get this working properly?&nbsp; I really appreciate any help.<br>