Select to view content in your preferred language

ListFeatureClasses comes back empty

2725
2
10-11-2012 01:44 AM
TomGeo
by
Frequent Contributor
Dear all,

I have a problem that comes and go's. Currently is is again immanent and I wonder what's causing it.

Working with ArcGIS 10 and using straight the IDLE from Python...

>>> import arcpy
>>> from arcpy import env
>>> env.workspace = r"Path\\to\\database.gdb"
>>> lstFDS = arcpy.ListDatasets("*", "FEATURES") # returns list of three items - correct
>>> lstPOLY = arcpy.ListFeatureClasses("*", "POLYGON", lstFDS[2])
>>> lstPOLY
[]


The dataset requested is holding almost 200 feature classes, all of them loaded with polygons.
I see all of them in ArcCatalog, but not in Python!

Anybody an idea? I already had a took care of remaining objects and invoked the garbage collector by hand but nothing.

Cheers Thomas
- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
Tags (2)
0 Kudos
2 Replies
MarcinGasior
Frequent Contributor
Your script works ok.
Does your third dataset (Python index = 2) contain polygon feature classes?

Maybe try checking lstPOLY in this way:
for fc in lstPOLY:
    print fc
0 Kudos
TomGeo
by
Frequent Contributor
The print loop comes back empty as well...

The weird thing is that one day there are no problems with it and the other one I have the stuff going on that currently happens. I restarted the machine, took care of unused objects etc.
The script works and some time the machine has ha bad day and isn't cooperating. :confused:

It's installed on a Windows Server 2008 R2, has plenty of RAM and memory on the HDD...

However, I created a new File Geodatabase, created the Feature Datasests and copied all the Feature Classes into the new GDB... now it works!?!

Thomas
- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos