“Operating system is not presently configured” error with Access ODBC

Copper Contributor

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")

 

 

 

3 Replies

@rathiaditya 

This looks like a "closing in" issue. I would take the next steps to solve or narrow down the problem:

 

  1. Run it on another machine and see if the problem occurs. 
  2. Check for recent Windows and Microsoft Office updates and roll them back if possible.
  3. Remove my Microsoft Office installation and install it again.
  4. Remove the Microsoft Access Database Engine Redistributable and install it again.
  5. Try to update pyodbc: pip install pyodbc --upgrade
  6. Try an alternative Python package for connecting to Access. For instance: pypyodbc (https://code.google.com/archive/p/pypyodbc/ ).

 

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

@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

https://stackoverflow.com/questions/63957789/operating-system-is-not-presently-configured-error-with...

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