When I run this part of my code, I get an error that says the parameters of the MakeFeatureLayer are not valid. However, when I run the first half of this script (the first try/except) and then run only the second part of the script, the code works, but errors if I run it all together. I'm guessing it is a workspace issue, but I can't figure it out.

import arcpy
import math

arcpy.env.overwriteOutput = True

pth = "C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/"
outname = "Family_" + arcpy.GetParameterAsText(0) + ".gdb"

arcpy.GetParameterAsText(0) + ".gdb"

arcpy.CreateFileGDB_management(pth, outname, "CURRENT")

wkspce = "C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/master_data"

arcpy.env.workspace = wkspce


    fcs = arcpy.ListFeatureClasses()
    for fc in fcs:
        arcpy.FeatureClassToGeodatabase_conversion(fc, pth + outname)
    print arcpy.GetMessages()

pth1 = "C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/"
outname1 = "Family_" + arcpy.GetParameterAsText(0) + ".gdb"
param1 = arcpy.GetParameterAsText(0)
famloc = "family_location_"
family = "Featured_Family_Location_updated"

arcpy.env.workspace = pth1 + outname1

    defquery = '"Family_ID" = ' + "'" + param1 + "'"
    featurein = pth1 + outname1 + "/" + family
    layer = "family_lyr"
    copyname = pth1 + outname1 + "/" + famloc + param1

    arcpy.CopyFeatures_management(layer, copyname)

    print arcpy.GetMessages()

This is the error :

ERROR 000732: Workspace or Feature Dataset: Dataset C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/Family_C:/Users/Dane/Desktop/Ever‌​ything/PSU/GEOG_596A/master_data\tracts.shp.gdb does not exist or is not supported Failed to execute (MakeFeatureLayer).

  • I'm not sure I follow, @GeoStoneMarten.
    – Dane
    Commented Nov 26, 2015 at 19:06
  • what object are you passing in arcpy.GetParameterAsText(0) ? Commented Nov 26, 2015 at 19:11
  • Individual letters. In this case, the letter "D", typed into pythonwin as D
    – Dane
    Commented Nov 26, 2015 at 19:14
  • I recommend removing try/except when testing/posting code snippets here because it can mask valuable error messages.
    – PolyGeo
    Commented Nov 26, 2015 at 19:52
  • 1
    @Hornbydd, I convert shapefiles to the created gdb from a folder. The tracts.shp is in the master_data folder. For some reason, when I try to save my layer (after a query), the script is somehow pulling that shapefile and messing up the paths...and I'll remind you that the code works if I break it in half. In other words, I comment out the second section and run the first part just fine. Then I comment out the first part and run the second, and it runs perfectly. It is when I try to run it all together that it errors.
    – Dane
    Commented Nov 26, 2015 at 22:18

2 Answers 2


Assuming arcpy.GetParameterAsText(0) returns the text FRED then featurein would be:


So does the Featureclass Featured_Family_Location_updated exist in that GeoDatabase, if not thats your problem.

  • Yes, it is there. That is the strange thing. This is the error I get: ERROR 000732: Workspace or Feature Dataset: Dataset C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/Family_C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/master_data\tracts.shp.gdb does not exist or is not supported Failed to execute (MakeFeatureLayer). The script is somehow mashing together paths/ shapefiles from the previous workspace with the featureclasses in the latter workspace...
    – Dane
    Commented Nov 26, 2015 at 18:39
  • @Dane please include your precise error message in your question.
    – PolyGeo
    Commented Nov 26, 2015 at 19:51
  • I have same error when passing last layer in ArcMap pyhton window; Runtime error Traceback (most recent call last): File "<string>", line 2, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\conversion.py", line 1697, in FeatureClassToGeodatabase raise e ExecuteError: ERROR 000732: Input Features: Dataset xxx_yyy_aaa does not exist or is not supported. I have resolve problem. arcpy.env.workspace need to be the same as ListFeatureClasses() object. Commented Nov 27, 2015 at 8:35
  • Don't switch the workspace with arcpy.env.workspace = pth1 + outname1. This is causing your error because it is invalid path. Python uses double back slashes or forward slash or the path flag "r" in front of the path string. After generating the shapefile list set the workspace to outname. In general use os.path to create your references to avoid this. Commented Dec 6, 2015 at 1:31

I have change the script to this:

import arcpy

def createGDB(path, name):
""" Create File GDB """

    arcpy.env.overwriteOutput = 1
    arcpy.CreateFileGDB_management(path, name, 'CURRENT')

def main(character):
    pth = 'C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/'
    outname = "Family_{}.gdb".format(character)

    # Get list of in_fc
    arcpy.env.workspace = 'C:/Users/Dane/Desktop/Everything/PSU/GEOG_596A/master_data'  # I think it contains shapefile
    print "source directory :\r\n{}{}".format(pth,outname)
    fcs = arcpy.ListFeatureClasses()

    print 'Insert data in gdb :\r\n{}{}'.format(pth,outname)
    out_wk = "{}{}".format(pth,outname)

        # set output with overwrite param
        # arccy.env.workspace = out_wk
        arcpy.env.overwriteOutput = 1  # I don't think it's needed because
                                       # process create exist_name_1
                                       # next pass exist_name_1_1

        # test insert dataset
        for fc in fcs:
            print "push fc : {}".format(fc)
        print arcpy.GetMessages()

    if __name__ == '__main__':

Can you test it? I have just a problem with one featureclass. I don't know why and check it with toolbox directly. I comeback later and comment problem with other test.

  • the error is arrived when the env.workspace is different of arcpy.ListFeatureClasses(). It continu to check in env.workspace. But this error don't arrived a the first featureclass contanied in list. It is not easy to understand because it arrived at the third featureclass i want to convert if env.workspace point to an other path (not the same as fcs = arcpy.ListFeatureClasses()). I think arcpy.env.overwriteOutput = 1isn't necessary because replacement isn't possible and it create <fcname>+"_1" ... Commented Nov 27, 2015 at 8:45

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.