I have the following code:

import arcpy
arcpy.env.overwriteOutput = True
coordinates = r"C:\Tiedostot\folder1\coordinates.xls\Sheet1$"
cursor = arcpy.da.SearchCursor(coordinates, ["X", "Y", "X2", "Y2"])

and I get the following error message:

Traceback (most recent call last):
File "<string>", line 5, in <module>
RuntimeError: cannot open 'C:\Tiedostot\folder1\coordinates.xls\Sheet1$'

The file path should definitely be right, and print(arcpy.Exists(coordinates)) gives False. What can I do to make this work?

  • Your code works fine for me and exists() returns true.
    – Hornbydd
    Commented Jul 11 at 9:35
  • Nice to hear; for me it doesn't.
    – cloudberry
    Commented Jul 11 at 10:23
  • Does the python user have permission to read the file
    – nmtoken
    Commented Jul 11 at 13:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.