Will arcpy.MakeFeatureLayer_management work with a personal geodatabase?

4914
6
04-15-2015 12:13 PM
DerekRyter
New Contributor II

I'm working in 10.2.2 and running this stand alone in Idle.

The script is very simple:

import arcpy

arcpy.MakeFeatureLayer_management('D:/SWB/SWB_grid_builder_eq_area2.mdb/precip_sites_yr', 'test')

The feature class is just fine and works in ArcMap. I even created a new mdb and new FC to make sure that it is the right version.

It works ok with gdb feature classes, but when I point it at an mdb as above it gives me:

ERROR 000732: Input Features: Dataset D:/SWB/SWB_grid_builder_eq_area2.mdb/precip_sites_yr does not exist or is not supportedFailed to execute (MakeFeatureLayer).

Anybody know what is going on?

Tags (1)
0 Kudos
6 Replies
MicahBabinski
Occasional Contributor III

Hello Derek,

Did you try running the Make Feature Layer through the geoprocessing tool dialog in arcmap? If that fails then this article from Esri may be relevant.

Since your feature class appears to be working normally everywhere but within the geoprocessing environment, it may be a question of an invalid subtype, an issue with on-the-fly projection (is your data frame in an XY coordinate system that matches the feature class from which you want to make a feature layer?), or maybe turning off background geoprocessing.

Hopefully one of these will work for you!

Warm Regards,

Micah

JakeSkinner
Esri Esteemed Contributor

Hi Derek,

This function should work on a personal geodatabase feature class.  Have you tried any other MDBs?  I would recommend creating another, import a feature class and see if this is reproducible.

0 Kudos
DerekRyter
New Contributor II

I have a gdb in the same folder. In AcCatalog I copied the feature class into it. I changed the code to point at it in the gdb instead of the mdb:

arcpy.MakeFeatureLayer_management('d:/swb/swb_data.gdb/precip_sites_yr', 'test')

And it runs without a problem.

I am only running it as a stand-alone script, saved as a python script, and executing it from Idle python editor. I need to do this to do other analyses outside of ArcMap. The full error message for the mdb printed above is below.

Traceback (most recent call last):

  File "D:/code/python/layer_test.py", line 7, in <module>

    arcpy.MakeFeatureLayer_management('D:/SWB/SWB_grid_builder_eq_area2.mdb/precip_sites_yr', 'test')

  File "C:\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 6043, in MakeFeatureLayer

    raise e

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000732: Input Features: Dataset D:/SWB/SWB_grid_builder_eq_area2.mdb/precip_sites_yr does not exist or is not supported

Failed to execute (MakeFeatureLayer).

I have checked it over and over. The FC exists and is just fine. The script worked in 10.1.

0 Kudos
DerekRyter
New Contributor II

I've now tried it on five different MDBs and GDBs, and even a shape file. It worked on the GDBs and shape file but not on the MDBs. Is there something that needs to be done to the MDB or a different syntax?

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Can you test this on another machine to see if the issue still occurs?  Also, what version of ArcGIS Desktop are you using?

0 Kudos
DerekRyter
New Contributor II

Solved it!! personal geodatabases are Access, which only works with 32-bit aps, you have to specify which python.exe you run. For making feature layers with feature classes in MDBs, you have to run the python script using

C:\Python27\ArcGIS10.2\python.exe

not

C:\Python27\ArcGISx6410.2\python.exe

Problem fixed.