[help] how to generate a empty ".MDB" file using python

D

Denton

Hi all:
I working in MS window environment. Now I want to use a python
script to import some data from CSV file to MDB file.
but I have some problems about creating MDB file in DAO.

I am using attached code , but the last line seems invalid.
Does anyone could help me. Thanks!

import win32com.client
eng=win32com.client.Dispatch("DAO.DBEngine.36")
eng.CreateDatabase("d:\\temp.mdb")



Regards
Denton
 
R

Roger Upole

Denton said:
Hi all:
I working in MS window environment. Now I want to use a python
script to import some data from CSV file to MDB file.
but I have some problems about creating MDB file in DAO.

I am using attached code , but the last line seems invalid.
Does anyone could help me. Thanks!

import win32com.client
eng=win32com.client.Dispatch("DAO.DBEngine.36")
eng.CreateDatabase("d:\\temp.mdb")



Regards
Denton

It's helpful if you post the traceback. I get
com_error: (-2147352567, 'Exception occurred.', (0, 'DAO.DbEngine', 'Invalid argument.', 'jeterr40.chm', 5003001, -2146825287),
None)

Apparently the Locale parameter is required.
eng=win32com.client.gencache.EnsureDispatch("DAO.DBEngine.36")
eng.CreateDatabase("d:\\temp.mdb", win32com.client.constants.dbLangGeneral)

hth
Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top