Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyodbc : Can't open lib 'Microsoft Access Driver (*.mdb, *.accdb)' : file not found (0)

Tags:

python

pyodbc

I have been sent an Access file to open, I am using a Mac and need to open it in Python

import pyodbc

DBfile = '/Users/burfies1/Dropbox/pricing/data.accdb' 
conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ='+DBfile)  
cur = conn.cursor()

I get the following error

conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ='+DBfile)  #    user/password can be used
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'Microsoft Access Driver (*.mdb, *.accdb)' : file not found (0) (SQLDriverConnect)")
like image 832
Burf2000 Avatar asked Oct 17 '22 15:10

Burf2000


1 Answers

The best solution for me was to just install MDBTools

https://github.com/brianb/mdbtools

Then use mdb-export to create a csv

mdb-export data.accdb TABLE > output_file.csv
like image 129
Burf2000 Avatar answered Oct 20 '22 11:10

Burf2000