I use this code to connect to my access (.mdb) database:
# -*- coding: latin-1 -*-
fileMDB = 'C:\\Python27\\OptimisateurLievre\\final\\Archives_PrevisionsESP_Août_2013.mdb'
param = "Driver={Microsoft Access Driver (*.mdb)};DBQ={%s};PWD={pw}" % fileMDB
con = odbc.connect(param)
I get the following error:
pyodbc.Error: ('HY000', '[HY000] [Microsoft][Pilote ODBC Microsoft Access] Filename incorrect. (-1044) (SQLDriverConnect); [HY000] [Microsoft][Pilote ODBC Microsoft Access] Filename incorrect. (-1044)')
The problem seems to come from the database filename with the û caracter. To my understanding of string and unicode, fileMDB is a string encoded in latin-1. Since, my computer runs with latin-1 encoding I don't understand why the filename is incorrect.
I work with Windows XP and python 2.7.
Thank you for your help!
 
                        
It appears that pyodbc tries to convert the connection string to
'ascii', so any characters above 0x7F are invalid:However, I was able to get it to work using pypyodbc: