ODBC access from Mac install of Python to Access database installed in Parallels
<p>I want to link my Python packages to my Access database, but I get this error. I use python 2.7.12 (shell).</p>

<pre><code>import pypyodbc

#create connection
con = pypyodbc.connect('DRIVER={Microsoft Access-Treiber (*.mdb)};UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL={MS Access};DriverId=25;DefaultDir=//Users/123GuteLaune/DatabaseMAformat.mdb')


cursor = con.cursor()

#Select Data
cursor.execute("SELECT * from TW-DS")

for row in cursor.fetchone():
    print(row)}
</code></pre>

<p>Traceback (most recent call last):<br>
  File "", line 1, in <br>
    import pypyodbc<br>
ImportError: No module named pypyodbc  </p>

<p><strong>Edit</strong></p>

<p>Hi after second installation following error occurs </p>

<p>Traceback (most recent call last): File "/Users/123GuteLaune/Python/connectionprogramm.py", line 4, in con = pypyodbc.connect('DRIVER={Microsoft Access-Treiber (*.mdb)};UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL={MS Access};DriverId=25;DefaultDir=//Users/123GuteLaune/DatabaseMAformat.mdb') File "build/bdist.macosx-10.6-intel/egg/pypyodbc.py", line 2435, in init self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly) File "build/bdist.macosx-10.6-intel/egg/pypyodbc.py", line 2484, in connect check_success(self, ret) File "build/bdist.macosx-10.6-intel/egg/pypyodbc.py", line 989, in check_success ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi) File "build/bdist.macosx-10.6-intel/egg/pypyodbc.py", line 976, in ctrl_err err_list.append((from_buffer_u(state), from_buffer_u(Message), NativeError.value)) File "build/bdist.macosx-10.6-intel/egg/pypyodbc.py", line 483, in UCS_dec uchar = buffer.raw[i:i + ucs_length].decode(odbc_decoding) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_32.py", line 11, in decode return codecs.utf_32_decode(input, errors, True) UnicodeDecodeError: 'utf32' codec can't decode bytes in position 0-1: truncated data</p>

<p><strong>Edit on 12.10.2016</strong></p>

<p>I use a Mac with macOS El Captain. I have the program "Parallels" on my laptop for using Access in a virtual machine. Python is installed on the Mac side.</p>

<p>What must I change that Python can use the ODBC interface to Access?</p>

<p><strong>Edit 13.10.2016</strong></p>

<p>I find a the toolkit "pyodbc" i think this should work on mac but again i can not ran the setup file i got the error. I already installed homebrew and find this dokumentation for installing (<a href="https://github.com/lionheart/django-pyodbc/wiki/Mac-setup-to-connect-to-a-MS-SQL-Server" rel="nofollow">https://github.com/lionheart/django-pyodbc/wiki/Mac-setup-to-connect-to-a-MS-SQL-Server</a>) </p>

<p>Error in python:
Traceback (most recent call last):
  File "/Users/123GuteLaune/connectionprogramm.py", line 1, in 
    import pyodbc
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyodbc.so, 2): Library not loaded: /usr/local/lib/libodbc.2.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyodbc.so
  Reason: image not found</p>

<p>If you are running Python on the Mac side then you need to use a driver that is compatible with macOS. The <code>Microsoft Access-Trebier (*.mdb)</code> ODBC driver is a Windows DLL (ODBCJT32.DLL) and I doubt very much that the Mac version of Python can use it.</p>

<p>You may be interested in the related question here:</p>

<p><a href="http://stackoverflow.com/q/25596737/2144390">Read an Access database in Python on non-Windows platform (Linux or Mac)</a></p>

python osx python-2.7 ms-access pypyodbc