I can use a da.searchcursor to connect to an mdb table using Pyhton 2.7, but when I try the exact same code in Python 3.6, I get an error that it cannot find the table. When I use the same exact code and point it to a gbd table it works fine
Did I miss something that python 3.6 and arcpy will not connect to mdb tables?
here's the code:
import arcpy
dataPath = "G:\\ArcGIS\\Standards\\Tools_and_Scripts\\SmokeTesting"
dbName = "17-078_Smoke_Field_KCMO_OCP.mdb"
sectionTbl = dataPath + "\\" + dbName +"\\tblSmkSewerSectionTable"
tbl = "G:\\ArcGIS\\Standards\\Tools_and_Scripts\\SmokeTesting\\17-078_Smoke_Field_KCMO_OCP.mdb\\tblSmkSewerSectionTable"
tblGD = "G:\\ArcGIS\\Standards\\Tools_and_Scripts\\MACP_Processing\\memphis_macp_test\\memphis_manhole_inspections_17_025_phase_5.gdb\\memphis_manhole_inspections_17_025_phase_5"
with arcpy.da.SearchCursor(tbl, '*') as cursor:
for row in cursor:
print('{0}, {1}, {2}'.format(row[0], row[1], row[2]))
and the error -
Traceback (most recent call last):
File "G:\ArcGIS\Standards\Tools_and_Scripts\mdbTest.py", line 9, in <module>
with arcpy.da.SearchCursor(tbl, '*') as cursor:
RuntimeError: cannot open 'G:\ArcGIS\Standards\Tools_and_Scripts\SmokeTesting\17-078_Smoke_Field_KCMO_OCP.mdb\tblSmkSewerSectionTable'
Are you using ArcGIS PRO? and its arcpy? I never used *.mdb so I can't test whether this applies to arcpy or not
http://pro.arcgis.com/en/pro-app/get-started/faq.htm
Can I use personal geodatabases (.mdb) as data sources for ArcGIS Pro?
No. Personal geodatabases are not supported in ArcGIS Pro, so you cannot use personal geodatabase datasets as inputs for geoprocessing tools or create those datasets as outputs. File geodatabases are fully supported and are the default workspaces for ArcGIS Pro projects.
Hello I have the same question as Robert, I get error message when trying to read my MDB (ms-access) table using the following code (I am in Jupyter notebooks for ArcgisPro, Python 3.6):
import arcpy
inTable = r'C:\Users\ANNE\ArcGIS\Survey_DB\MyDatabase.mdb\SURVEY_ID'
DBsurveys = []
with arcpy.da.SearchCursor(inTable, ['SURVEYID', 'DTM_QC', 'SURVEY_TYPE']) as cursor:for row in cursor:
DBsurveys.append((row[0], row[1], row[2]))
This code is working perfectly well as an arcpy script (python 2.7).
I read the answer above which was given to Robert and it does not answer the question at all. We are talking about MDB table here, so NOT a geodatabase. The error message I get is:
RuntimeError: cannot open 'C:\Users\ANNE\ArcGIS\Survey_DB\MyDatabase.mdb\SURVEY_ID'
Is there something I am missing? Is it that we cannot read in MDB tables anymore?
Is it possible to get answer from ESRI staff?
Thanks a lot in advance,
Anne
From the esri staff that write the documentation
Frequently asked questions—ArcGIS Pro | Documentation
Can I use personal geodatabases (.mdb) as data sources for ArcGIS Pro
Anything associated with a table in a personal geodatabase can't be read