comtypes

Problem Inserting data into MS Access database using ADO via Python

[Edit 2: More information and debugging in answer below...] I'm writing a python script to export MS Access databases into a series of text files to allow for more meaningful version control (I know - why Access? Why aren't I using existing solutions? Let's just say the restrictions aren't of a technical nature). I've successfully expo...

Problem using Python comtypes library to add a querytable to Excel

I'm trying to create a QueryTable in an excel spreadsheet using the Python comtypes library, but getting a rather uninformative error... In vba (in a module within the workbook), the following code works fine: Sub CreateQuery() Dim con As ADODB.Connection Dim rs As ADODB.Recordset Dim ws As Worksheet Dim qt As QueryTabl...

What does #if !USING_NET11 using System.Runtime.InteropServices.ComTypes; #endif mean ?

Hi, what does the following code mean and what does it do ? Is it really required ? #if !USING_NET11 using System.Runtime.InteropServices.ComTypes; #endif In my project file I have implemented the web cam capture using the dshownet wrapper. The above code was there in the Form1.cs file. Many Thanks ...

Why can't I create a COM object in a new thread in Python?

I'm trying to create a COM Object from a dll in a new thread in Python - so I can run a message pump in that thread: from comtypes.client import CreateObject import threading class MessageThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.daemon = True def run(self): pri...

Can't import comtypes.gen

I have comtypes 0.6.2 installed on Python 2.6. If I try this: import comtypes.gen I get: Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> import comtypes.gen ImportError: No module named gen Other imports like import comtypes and import comtypes.client, however, work fine. What am I doing wrong? ...

Python, ArcObjects, and .AppRef: how to get from IAppROT to IMxDocument?

I am writing an external Python/comtypes script (in PythonWin) that needs to get a reference to the current ArcGIS 10.0 ArcMap session (through the ArcObjects COM). Because the script is outside the application boundary, I am getting the application reference through the AppROT (running object table). The first code snippet below is the...