Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

10.2 SearcCursor Doesn't recognize file path

$
0
0
Hey everyone,

In 10.1, if I ran the script below and had no issues. Since my upgrade to 10.2, I am getting an error.

I simply created a .xlsx file from Excel 2007. I created one field called "Test_Field" and then populated 6 rows with a,b,c,d,e,f under the field heading. I created this simple script to run on that excel file:

Code:

import arcpy

TableList = []

for row in arcpy.SearchCursor(r"Z:\ESRI\Python\Test_Excel\Test_book.xlsx\Sheet1$"):
        TableList.append(row.Test_Field)

I keep getting the following error:

Quote:

Traceback (most recent call last):
File "Z:/ESRI/Python/Test Scripts/row102.py", line 5, in <module>
for row in arcpy.SearchCursor(r"Z:\ESRI\Python\Test_Excel\Test_book.xlsx\Sheet1$"):
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 1167, in SearchCursor
return gp.searchCursor(dataset, where_clause, spatial_reference, fields, sort_fields)
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 359, in searchCursor
self._gp.SearchCursor(*gp_fixargs(args, True)))
IOError: "Z:\ESRI\Python\Test_Excel\Test_book.xlsx\Sheet1$" does not exist
In 10.1 I had no issue with this exact script. Is there something in the upgrade to 10.2 that I am missing? I know they created a new Excel toolbox that only runs on .xls files. I tested this on a .xls file as well and I am returning the same error.

I have 10.2 installed on my 64bit Windows 7 machine.

Viewing all articles
Browse latest Browse all 2485

Trending Articles