Hello! I try to open and write an (Access 2000) mdb file, and get an error I cannot interpret.
This code as worked in the past (two months ago) and works without modification on a different PC of a colleague, so chances are my configuration misses a simple thing, a software package (update) or something other trivial. My System is Win7, Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32, pywin32-219.win-amd64-py2.7.exe Microsoft Office Access 2007 (12.0.6696.1000) SP3 MSO (12.0.6718.5000) Could this be some 32-bit vs. 64-bit thing? (ATM I can not check whether my colleague still uses an older (32bit?) installation.) this is the source -------------------- try: print "Open ADOB.Connection" ado = win32com.client.Dispatch("ADODB.Connection") connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\"%s\"" % filename # Access 2003 #connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"%s\"" % filename # Access 2007 print "Open ADOB.Connection with '%s'" % connectionstring ado.Open(connectionstring) except pythoncom.com_error, (hr, msg, exc, arg): # pylint: disable=E1101 print "The Access call failed with code %d: %s" % (hr, msg) if exc is None: print "There is no extended error information" else: wcode, source, text, helpFile, helpId, scode = exc print "The source of the error is", source print "The error message is", text print "More info can be found in %s (id=%d)" % (helpFile, helpId) raise return ado ------------ This is the result ------------------ Open ADOB.Connection with 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source="out\Stoermeld-B97.mdb"' The Access call failed with code -2147352567: Ausnahmefehler aufgetreten. The source of the error is ADODB.Connection The error message is Der Provider kann nicht gefunden werden. Möglicherweise ist er nicht richtig installiert worden. More info can be found in C:\WINDOWS\HELP\ADO270.CHM (id=1240655) Traceback (most recent call last): File "D:\PRJ\DPS\bin\stoerungsmeldungen.py", line 1117, in <module> options.opcid) File "D:\PRJ\DPS\bin\stoerungsmeldungen.py", line 893, in write_oms myoms = omsdatabase.OMS(omsname) File "D:\PRJ\DPS\bin\omsdatabase.py", line 225, in __init__ self._ADOconnectionObject = access_open(filename) File "D:\PRJ\DPS\bin\omsdatabase.py", line 183, in access_open ado.Open(connectionstring) File "C:\Python27\lib\site-packages\win32com\gen_py\B691E011-1797-432E-907A-4D8C69339129x0x6x1.py", line 3523, in Open , UserID, Password, Options) File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 459, in _ApplyTypes_ self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args), pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', (0, u'ADODB.Connection', u'Der Provider kann nicht gefunden werden. M\xf6glicherweise ist er nicht richtig installiert worden.', u'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240655, -2146824582), None) --------- ---- if I try the ACE 12 string that should (according to some googling) belong to the JET module of Access 2007 which is installed on the PC (opening the mdb with double click works just fine), I get: ----- Open ADOB.Connection with 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source="out\Stoermeld-B97.mdb"' The Access call failed with code -2147352567: Ausnahmefehler aufgetreten. The source of the error is ADODB.Connection The error message is Der Provider kann nicht gefunden werden. Möglicherweise ist er nicht richtig installiert worden. More info can be found in C:\WINDOWS\HELP\ADO270.CHM (id=1240655) Traceback (most recent call last): File "D:\PRJ\DPS\bin\stoerungsmeldungen.py", line 1117, in <module> options.opcid) File "D:\PRJ\DPS\bin\stoerungsmeldungen.py", line 893, in write_oms myoms = omsdatabase.OMS(omsname) File "D:\PRJ\DPS\bin\omsdatabase.py", line 225, in __init__ self._ADOconnectionObject = access_open(filename) File "D:\PRJ\DPS\bin\omsdatabase.py", line 183, in access_open ado.Open(connectionstring) File "C:\Python27\lib\site-packages\win32com\gen_py\B691E011-1797-432E-907A-4D8C69339129x0x6x1.py", line 3523, in Open , UserID, Password, Options) File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 459, in _ApplyTypes_ self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args), pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', (0, u'ADODB.Connection', u'Der Provider kann nicht gefunden werden. M\xf6glicherweise ist er nicht richtig installiert worden.', u'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240655, -2146824582), None) ------ I must admit that I have little knowledge about COM and wrote this code by copying and modyfiying code examples I found. It worked rather well in the past, but now it fails for me (and still works for other people). What can I try next? Is this the best way to access an mdb database from python (2.7) or what would be preferred? Mit freundlichen Grüßen Dr. Hartmut Niemann Siemens AG Mobility MO MLT LM EN CCI 1 Werner-von-Siemens-Str. 67 91052 Erlangen, Deutschland Tel.: +49 9131 7-34264 Fax: +49 9131 7-26254 mailto:hartmut.niem...@siemens.com Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; Vorstand: Joe Kaeser, Vorsitzender; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Siegfried Russwurm, Ralf P. Thomas; Sitz der Gesellschaft: Berlin und München, Deutschland; Registergericht: Berlin Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32