arcpy.ListDatasets does not return PersonalGeodatabases

827
1
Jump to solution
04-12-2018 10:28 PM
Carolinvon_Groote
New Contributor II

Hello,

I have troubles using arcpy.ListDatasets in case of personal geodatabases. I have created a personal geodatabase in ArcMap (10.4.1) inclunding a feature class. Now I want to find the geodatabase and its feature class(es) with arcpy.ListDatasets (respectively ListFeatureClasses based on the output of arcpy.ListDatasets).

#path where personal geodatabase test_pgb.mdb is stored
test_path = r"H:\16\UTM\9999_dummy_data\test_pgb"
>>> arcpy.env.workspace = test_path 
>>> arcpy.ListDatasets()
[]
>>> arcpy.ListDatasets('*','Feature')
[]

What am I doing wrong?

The feature class contains no feautres yet (what in my opinion should be irrelevant).

Thanks a lot for your help,

Carolin

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

List  datasets is used in case of listing feature datasets inside a geodatabase. If that is what you want your workspace should point to the personal geodatabase and not the folder where the personal geodatabase is stored. If you want to list the personal geodatabases, you will have to use ListWorkspaces.

Have a look at the thread below where first the personal geodatabase are listed, and then for each PGDB the feature datasets are listed followed by listing the featureclasses in the feature datasets:how to convert mdb to gdb 

View solution in original post

1 Reply
XanderBakker
Esri Esteemed Contributor

List  datasets is used in case of listing feature datasets inside a geodatabase. If that is what you want your workspace should point to the personal geodatabase and not the folder where the personal geodatabase is stored. If you want to list the personal geodatabases, you will have to use ListWorkspaces.

Have a look at the thread below where first the personal geodatabase are listed, and then for each PGDB the feature datasets are listed followed by listing the featureclasses in the feature datasets:how to convert mdb to gdb