Sep 18 2020 08:28 AM
I get the following error when I try to connect to Microsoft Access Database via Python. The code has been working all this time and only started popping the error today. Can someone please guide me what may be the problem occurring now?
I tried doing this https://stackoverflow.com/questions/63899661/operating-system-is-not-presently-configured-error-with... even after removing the “Office 16 Click-to-Run Extensibility Component 64-bit Registration” my problem isn't getting solved.
import pyodbc as pyo
import os
#print(pyo.drivers())
filename='//MCISERVER1/TestData/access/Proof.mdb'
full_file=os.path.abspath(os.path.join('data',filename))
print("opening access")
Driver='{Microsoft Access Driver (*.mdb, *.accdb)}'
access_driver=['MS Access Database']
try:
cnn=pyo.connect(driver=Driver,dbq=full_file,autocommit=True)
except pyodbc.Error as ex:
print("Error connecting")
cursor=cnn.cursor()
sql="select * from [ERT ITRON] as e where e.SO='7888'"
cursor.execute(sql)
for row in cursor.fetchall():
print(row)
print("success")
cursor.close()
cnn.close()
print("connection closed")
Sep 19 2020 04:20 AM - edited Sep 19 2020 04:21 AM
This looks like a "closing in" issue. I would take the next steps to solve or narrow down the problem:
Options 5 and 6 are merely solving the symptoms (if they work), rather than solving the problem. But if they fixe the issue, they could save the day.
Good luck and best wishes,
Tieme
Sep 21 2020 05:24 AM
@Tieme Woldman I had done all the things of installing and uninstalling the microsoft office, python or pyodbc and sqlalchemy libraries but it didn't work. But my main problem was solved when I removed Microsoft Access Database engine driver and put the latest version on my pc.
Thanks for the help
Sep 22 2020 03:16 AM - edited Sep 22 2020 03:56 AM
Hi,
I'd say your solution is essentially no 4 on Tieme's list.
This is a hiccup in the Breaking ACE out of the bubble works and should get fixed with one of the next O365 updates. Until then, the workaround is to reinstall the 2016 Redistributable in order to have the ODBC driver working again.
Karl
*********
http://AccessDevCon.com
http://donkarl.com