"Operating system is not presently configured" error with Access ODBC

Viewed 1144

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?

Below is, how I connect to MS Access in Python.

import pyodbc
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=E:Folder\Database.accdb;')

Error:

The operating system is not presently configured to run this application.

enter image description here

2 Answers

I had the same issue and solved the problem installing this Microsoft complement:

https://www.microsoft.com/en-us/download/details.aspx?id=54920

It might give you some problems when you try to install it. In my case I had this message:

"You cannot install the 32-bit version of Microsoft Access Database Engine 2016 because you currently have 64-bit Office products installed..."

If so, you can try this:

  1. Press Win + R to open the Run window, type “installer” and click Enter to open the folder in File Explorer.
  2. Add the column “Subject”. Right click the column headers, then click More and select Subject
  3. Sort on the Subject column and scroll down until you locate the name “Office 16 Click-to-Run Extensibility Component 64-bit Registration”.
  4. Right click the MSI file and choose uninstall.

And try to install it again. I'm not an expert but that worked for me.

References:

(can't comment yet)

Further to julioq's answer: If you run the downloaded accessdatabaseengine.exe file with the /quiet option you don't need to uninstall the 64-bit stuff.

So:

  1. <Win>+R to open the Run dialog

  2. Browse to the downloaded accessdatabaseengine.exe and select it

  3. Add /quiet to that (outside of any quote marks if the appear), e.g.

    "C:\temp\accessdatabaseengine.exe" /quiet

  4. Ok to run

Related