I need to access the dbf file to extract variable list (i.e. "CODE"). Basically I am calling dbf file to allMamrows variable and then I am appending using for loop. On running the script I am getting the following error. The dbf file is at right location, but still I am getting a error that file that does not exist. Please let me know what's wrong with the search cursor function in the script.
Traceback (most recent call last):
File "C:\Users\Mukhtar_Ahmed\Desktop\Assignment_8\Python\MambalHab_Iterations.py", line 29, in <module>
allMamRows = arcpy.SearchCursor ("Desktop\\Assignment_8\\GAPanalysisData\\Flmammal.dbf")
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\__init__.py", line 1179, in SearchCursor
return gp.searchCursor(dataset, where_clause, spatial_reference, fields, sort_fields)
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\geoprocessing\_base.py", line 359, in searchCursor
self._gp.SearchCursor(*gp_fixargs(args, True)))
IOError: "Desktop\Assignment_8\GAPanalysisData\Flmammal.dbf" does not exist.
Script
# Reading data from mammals list access file
allMamRows = arcpy.SearchCursor ("Desktop\\Assignment_8\\GAPanalysisData\\Flmammal.dbf")
# loop through mammals table and loading the codes into the list
mamList = []
i=0
for row in allMamRows:
mamList.append(row.getValue("CODE"))
print mamList[i]
i = i +1