py2exe + win32com + DAO

David Lyon david.lyon at
Wed May 13 02:31:11 CEST 2009

Maybe VB is opening the table in Exclusive mode... then when you
are opening it as a subprocess, it's already locked.

It's possible the win32com module is not giving you a very
descriptive error message.

Try running your process while vb is running at the same time
with the database open and if you get the same error then it 
might confirm my assertion.

Otherwise it is likely that it is something else.

On Tue, 12 May 2009 17:20:15 -0700 (PDT), Trevor <trevor.lango at>
> I have a Python code module that adds records to a MS Access
> database.  The following line of code executes successfully when the
> code module is run as a Python script:
> daoEngine = win32com.client.Dispatch(r'DAO.DBEngine.36')
> It also runs successfully when the Python script is compiled and run
> as an executable using the Py2exe utility.  However, when the compiled
> executable is called from VBA using the win32 CreateProcess function,
> the preceding code produces this output:
> !!python/name:pywintypes.com_error ''
> What is causing this error?

More information about the Python-list mailing list