0

I am trying to run some code that works fine in Python 2.7 +, but seems to throw an error in a 2.65 environment:

Error: ListFeatureClasses() got an unexpected keyword argument 'feature_type' ListFeatureClasses() got an unexpected keyword argument 'feature_type'

The line of code is simple and works fine in 2.7+:

arcpy.ListFeatureClasses(wildCard,feature_type = 'Polygon')

It throws a the same error in another line of code but for workspace_type = 'FileGDB'

Any ideas how to resolve this in 2.65?

  • 1
    Are you using ArcPy with ArcGIS Pro or ArcGIS Desktop 10.x here? Your Python version suggests the latter but I would like to be certain before deciding whether to try and answer. – PolyGeo Oct 30 '18 at 20:01
  • Your ArcGIS release is ancient. It's not the Python so much as the capabilities of the arcpy site extension at that release. If you locate the documentation, it likely has a different usage. – Vince Oct 30 '18 at 23:27
  • I am using a super old version of ArcMap (10.0) with Python 2.65. Hence all the problems. – gwydion93 Oct 31 '18 at 4:04
  • Your code is fine according to the docs for 10.0 help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… but seeing as feature_type is the 2nd parameter why implicitly specify it, it should work just fine like arcpy.ListFeatureClasses(wildCard, 'Polygon') unless you've copied the word 'Polygon' from the help, in which case you may have a non-printing character that's gumming up the works... 10.0 documentation has many instances of NPCs' which makes copy/paste unwise; this is fixed (mostly) in 10.2 docs. I suggest an upgrade should be your next consideration. – Michael Stimson Oct 31 '18 at 5:27
0

I was able to overcome this problem by simply removing the keyword and just putting "Polygon" in quotes:

arcpy.ListFeatureClasses(wildCard,"Polygon")

This worked for the other cases as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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