I am very new to GIS.

I just installed eclipse luna with pydev plug-in and ArcGIS 10.1 for Desktop.

When I write a script, trying to import arcpy.da.SearchCursor I see that no SearchCursor is available to autocomplete.

enter image description here

What is the problem? What I did wrong?

3 Answers 3


I don't think the original poster was asking about how to use arcpy.da.SearchCursor(), but rather that the arcpy.da.SearchCursor() class was not appearing in the code completion window within Eclipse (sometimes called intellisense or intelligent code completion).

I've been using Eclipse+PyDev and/or LiClipse for editing code for geoprocessing tools since ArcGIS 10.1 came out, and I have never been able to get code completion for any arcpy.da modules. There are a few posts about this on the Esri GeoNet (formerly Esri forums), see one, two, and three. In thread one, Dave from Esri says (emphasis mine):

The overriding goal for the data access module was speed. As I'm sure you're aware the older cursor model wasn't nearly as fast. As part of that, arcpy.da doesn't have the Python wrappers that provide the dropdown's that you see in most of arcpy. Essentially, it was a trade-off between speed and IDE-friendliness, and in this case the criterion dictated speed trump.

So unfortunately, there's no way to get Eclipse's nice code completion for the da module. However, you can still avoid the annoying red Undefined variable from import: SearchCursor error in Eclipse by putting #@UndefinedVariable at the end of the line, like so:

MyCursor = arcpy.da.SearchCursor("MyLayer",["*"]) #@UndefinedVariable
  • 2
    Exactly this. It's a pure CPython implementation with no Python source wrapping it, so most IDEs can't interrogate it for autocomplete. Commented Oct 31, 2014 at 17:50
  • Yey, I now understand, and I will take this as is. Commented Nov 1, 2014 at 18:56
  • Great explanation, Dan - thank you for summarizing and providing a band-aid :)
    – julie
    Commented Apr 17, 2015 at 12:55
  • Adding "#@UndefinedVariable" works for me, Thank you :) Funny thing, though. Adding a 2nd ".da" to the text: "arcpy.da.da." awakens the code completion in PyDev (Eclipse Luna), but causes execution error, even with "#@UndefinedVariable".
    – user50991
    Commented Apr 23, 2015 at 20:53
  • @dmahr i fact that is not really true. You can just add arcpy.da in force builtins pannel for completion. Commented Mar 6, 2017 at 9:18

SearchCursor is a class in the arcpy.da module and not a module itself, so if you wanted to import just that class you could use:

from arcpy.da import SearchCursor

You could then reference it as just SearchCursor.

You can also import the entire module and reference the class within, and it's also worth noting that import arcpy automatically imports arcpy.da and a bunch of other arcpy related things.

  • It doesn't work for me.
    – greyline
    Commented Jan 23, 2015 at 11:07
  • I have discovered that the import arcpy and arcpy.da.SearchCursor works even if the Eclipse underline that with red line O.o
    – greyline
    Commented Jan 23, 2015 at 11:24
  • 2
    @gregtom6 you need Forced builtins for arcpy.da . Go to Preferences > PyDev > Interpreters > Python Interpreter > Forced builtins. Click on New... and add arcpy.da has value. Finaly apply change and all will work Commented Mar 6, 2017 at 9:16
  • @GeoStoneMarten that worked for me, minor typo correction, you enter arcpy.da as value. (I only mention it because I was momentarily confused and thought the entire entry was "arcpy.da has value", which was more due to my inexperience with Python in Eclipse). Thanks!
    – Bill B
    Commented Jul 31, 2019 at 0:23
  • I'm thinking that also explains why pylint always tells me "Module 'arcpy.da' has no 'UpdateCursor' member" Commented Jul 15, 2020 at 16:30

I fixed this by adding 'arcpy' and 'arcpy.da' to my 'Forced Buitins' tab for my Arcpy Python Interpreter in eclipse. Code completion works and it no longer marks things like da.SearchCursor as an undefined variable.

  • Following this and @GeoStoneMarten's suggestion above is what worked for me.
    – Bill B
    Commented Jul 31, 2019 at 0:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.