Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1039431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:05:55+00:00 2026-05-16T15:05:55+00:00

I have several csv files that I need to transfer over to mdb format.

  • 0

I have several csv files that I need to transfer over to mdb format. I tried the answer in this post as a starting point:

How do you create a mdb database file in Python?

Source:

from comtypes.client import CreateObject

access = CreateObject('Access.Application')

from comtypes.gen import Access

DBEngine = access.DBEngine
db = DBEngine.CreateDatabase('test.mdb', Access.DB_LANG_GENERAL)


db.BeginTrans()

db.Execute("CREATE TABLE test (ID Text, numapples Integer)")
db.Execute("INSERT INTO test VALUES ('ABC', 3)")

db.CommitTrans()
db.Close()

But I received the following errors:

Traceback (most recent call last):
  File "C:\Documents and Settings\rkelly1\Desktop\New Folder (6)\testwrite.py", line 3, in ?
access = CreateObject('Access.Application')
  File "C:\Python24\Lib\site-packages\comtypes\client\__init__.py", line 242, in CreateObject
return _manage(obj, clsid, interface=interface)
  File "C:\Python24\Lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
  File "C:\Python24\Lib\site-packages\comtypes\client\__init__.py", line 112, in GetBestInterface
interface = getattr(mod, itf_name)
AttributeError: 'module' object has no attribute '_Application'

All I need to do is take a .csv file, and create a database with it in mdb format. I have some experience with sql but not with creating access data base files….

EDIT:

I am not proposing that this is the right solution…. If you have a better one please let me know

EDIT: The first time the script runs after a fresh install of comtypes I get these errors:

# Generating comtypes.gen._4AFFC9A0_5F99_101B_AF4E_00AA003F0F07_0_9_0
# Generating comtypes.gen._2DF8D04C_5BFA_101B_BDE5_00AA0044DE52_0_2_4
# Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
# Generating comtypes.gen.stdole
Traceback (most recent call last):
  File "C:\Documents and Settings\rkelly1\Desktop\New Folder (6)\testwrite.py", line 3, in ?
    access = CreateObject('Access.Application')
  File "C:\Python24\Lib\site-packages\comtypes\client\__init__.py", line 242, in CreateObject
    return _manage(obj, clsid, interface=interface)
  File "C:\Python24\Lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
    obj = GetBestInterface(obj)
  File "C:\Python24\Lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
    mod = GetModule(tlib)
  File "C:\Python24\Lib\site-packages\comtypes\client\_generate.py", line 112, in GetModule
    mod = _CreateWrapper(tlib, pathname)
  File "C:\Python24\Lib\site-packages\comtypes\client\_generate.py", line 176, in _CreateWrapper
    generate_module(tlib, ofi, pathname)
  File "C:\Python24\Lib\site-packages\comtypes\tools\tlbparser.py", line 716, in generate_module
    gen.generate_code(items.values(), filename=pathname)
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 238, in generate_code
    self.generate_all(items)
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 186, in generate_all
    self.generate(item)
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 182, in generate
    mth(item)
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 689, in ComInterface
    self.generate(itf.get_head())
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 182, in generate
    mth(item)
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 710, in ComInterfaceHead
    self.generate(base.get_head())
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 182, in generate
    mth(item)
  File "C:\Python24\Lib\site-packages\comtypes\tools\codegenerator.py", line 616, in External
    comtypes.client.GetModule(ext.tlib)
  File "C:\Python24\Lib\site-packages\comtypes\client\_generate.py", line 112, in GetModule
    mod = _CreateWrapper(tlib, pathname)
  File "C:\Python24\Lib\site-packages\comtypes\client\_generate.py", line 188, in _CreateWrapper
    mod = _my_import(fullname)
  File "C:\Python24\Lib\site-packages\comtypes\client\_generate.py", line 26, in _my_import
    return __import__(fullname, globals(), locals(), ['DUMMY'])
  File "C:\Python24\lib\site-packages\comtypes\gen\_2DF8D04C_5BFA_101B_BDE5_00AA0044DE52_0_2_4.py", line 82
    ( ['retval', 'out'], POINTER(POINTER(IDispatch)), 'ppidisp' )),
COMMETHOD([dispid(1610743809), 'propget'], HRESULT, 'Creator',
                                                               ^
SyntaxError: invalid syntax
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:05:56+00:00Added an answer on May 16, 2026 at 3:05 pm

    First thing I would suggest is upgrading to python 2.7 if at all possible.

    Second, have you tried win32com?

    Here’s a test script that does what you have above:

    import win32com.client
    import os
    
    def main():
        db_path = r'C:\temp.mdb'
        if os.path.exists(db_path):
            os.remove(db_path)
    
        db_eng = win32com.client.gencache.EnsureDispatch("DAO.DBEngine.36")
        db = db_eng.CreateDatabase(db_path, win32com.client.constants.dbLangGeneral)
    
        db.Execute("CREATE TABLE test (ID Text, numapples Integer)")
        db.Execute("INSERT INTO test VALUES ('ABC', 3)")
    
        db.Close()
    
    
    if __name__ == '__main__':
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several csv's that look like this: I have several large text files
I have several large csv files with thousands of columns that I need to
I have a csv that has several columns. I need the middle columns to
I have several xml files that are formated this way: <ROOT> <OBJECT> <identity> <id>123</id>
I have tried the merge function to merge two csv files that I imported.
I have several files with similar data that I need to plot using gnuplot.
..I need to modify several CSV's as follow's... This is what I have: 2012-08-13
I have two groups of files that contain data in CSV format with a
I have several CSV files with the format: Year,Day,Hour,Min,Sec.,P1'S1 2003, 1, 0, 0,12.22, 0.541
I have several .csv files with similar filenames except a numeric month (i.e. 03_data.csv,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.