Python Workspace and MakeFeatureLayer Issue

المشرف العام

Administrator
طاقم الإدارة
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 arcpyimport matharcpy.env.overwriteOutput = Truepth = "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 = wkspcetry: fcs = arcpy.ListFeatureClasses() for fc in fcs: arcpy.FeatureClassToGeodatabase_conversion(fc, pth + outname)except: 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

try: defquery = '"Family_ID" = ' + "'" + param1 + "'" featurein = pth1 + outname1 + "/" + family layer = "family_lyr" copyname = pth1 + outname1 + "/" + famloc + param1 arcpy.MakeFeatureLayer_management(featurein,layer,defquery) arcpy.CopyFeatures_management(layer, copyname)except: print arcpy.GetMessages()##

أكثر...
 
أعلى