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

Roger Upole rupole at hotmail.com
Sun Jan 15 08:21:32 EST 2006


"Denton" <Denton at anonymous.com> wrote in message news:86ojs15ij01n7igjdone9ua6pukv2oveba at 4ax.com...
> 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



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----



More information about the Python-list mailing list