0

The following images will show my model. I used a piece of Python script and trying to get the output from it as a layer and use it for rest of the tool. However, I am getting error as displayed in one of the following image. could someone help me on solving this problem.

Python Script Used in Model-Builder Error Code After Running the model

import arcpy
from arcpy import env
import os
arcpy.env.overwriteOutput = True
Match_FC=arcpy.GetParameterAsText(0)
Match_F=Match_FC[-13:-4]
#env.workspace =arcpy.GetParameterAsText(0)
output=arcpy.GetParameterAsText(1)
fcList = arcpy.ListFeatureClasses()
# Copy shapefiles to a folder 
for fc in fcList:
    for fc in fcList:
        print fc[-13:-4]
        if fc[-13:-4]==Match_F:
            arcpy.MakeFeatureLayer_management('in_memory\fc', 'in_memory\output','')
            break

ERROR 00229: Cannot open C:\User\Documents\ArcGis\Default.gdb\Rel_AA_001_Compari Failed to execute (Make Feature Layer)

11
  • Please always include errors as text rather than pictures so that they can be searched for. I suspect that you will have trouble attracting a potential answerer to this one because you are showing us your whole model and code instead of extracting a minimal test model and test code out.
    – PolyGeo
    Mar 17, 2016 at 4:43
  • I added my code and took out extra information. I believed the error can be shown as screenshot.
    – Koush
    Mar 17, 2016 at 4:55
  • I and any other potential answerers of your questions all volunteer our time to help question askers, but our prime goal is to build high quality content for the GIS Stack Exchange, so that people do not need to ask for answers, they just find them instead. To help us in our endeavours to help you and others we want to teach you as quickly as possible how to write high quality questions. There is a good summary of that philosophy in this Q&A meta.gis.stackexchange.com/questions/4181/…
    – PolyGeo
    Mar 17, 2016 at 5:28
  • OK, Thx for clear answer and helping others. I relay appreciate your help and others. I found this web site very helpful and valuable. Thx again for all your/others support.
    – Koush
    Mar 17, 2016 at 5:32
  • 1
    I can see the error message in your picture, but we ask for error messages as text, so that searches by other people experiencing the same error can see it too.
    – PolyGeo
    Mar 17, 2016 at 6:38

1 Answer 1

-1

I just add one more line to get parameter as text and then I created a script or Python tool. The parameters for this tool are: 2 inputs and 1 output. I also added an arcpy. Deletemanagement before output to clean the output after each run. Also I took out the in_memory function from the make feature layer line, then added an extra variable and equaled it to the name/value from iterator and used it for entire script.

1
  • This answer would be more useful if you included a working code snippet instead of describing how a non-working code snippet would need to be modified to make it work.
    – PolyGeo
    Apr 7, 2016 at 1:43

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.