4

I have a script that is run using a combination of ArcObjects and a python script. The process starts in C# Arcobjects code, I create a geoprocessor, and then I run a toolbox tool (python script) with uploaded data from the user. The data is uploading successfully, I can see it in file explorer, however my python script says it doesn't exist. Now if I go in the python IDE, the script runs just fine there using the same file in the same location. I'm not sure what's going on.

This sets up the toolbox and passes the file geodatabase to the toolbox tool and runs it:

 //Set up HabitatClassification script
 IGeoProcessorResult result;
 IGeoProcessor2 gp = new GeoProcessor() as IGeoProcessor2;
 string tlbxPath = Server.MapPath("~/ArcToolbox/HabitatMon.tbx");
 gp.AddToolbox(@tlbxPath);
 IVariantArray parameters = new VarArray();
 parameters.Add(geodatabase);

 //Run Habitat Classification script
 try
 {
   result = gp.Execute("HabitatClassification", parameters, null);
 }

Now that I have passed the file geodatabase into the tool, in the python script, I set up the workspace and get the list of feature classes in the FGDB. It perform this step just fine, so clearly it can find the feature class I am looking for and it does, indeed, exist.

#Get user uploaded geodatabase and set the workspace to it
uploadedGDB = sys.argv[1]
arcpy.env.workspace = uploadedGDB

#Get the patch feature class out of the geodatabase.
#is only one feature class within it.
patchfc = arcpy.ListFeatureClasses("*Patch*")
svyPtFC = uploadedGDB + r"\{0}".format(patchfc[0])

At this point in time, svyPtFC looks like this: C:\Users\xxx\Desktop\GIS_NET_Testing\ArcObjectsTesting\ArcObjects\UploadedFiles\NETTesting.gdb_02_17_2018_11_29_23\NETTesting.gdb\Patches

It errors out on the next line: result = arcpy.GetCount_management(svyPtFC)

As a result, I get this displayed on my webpage (and you can clearly see it has the correct path the feature class displayed):

Traceback (most recent call last):

File "C:\Users\xxx\xxx\PythonProjects\HabitatClassification.py", line 300, in <module>
result = arcpy.GetCount_management(svyPtFC)

File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\management.py", line 17419, in GetCount
raise e

ExecuteError: Failed to execute. Parameters are not valid.

ERROR 000732: Input Rows: Dataset C:\Users\xxx\Desktop\GIS_NET_Testing\ArcObjectsTesting\ArcObjects\UploadedFiles\NETTesting.gdb_02_17_2018_11_29_23\NETTesting.gdb\Patches does not exist or is not supported

Failed to execute (GetCount).

Failed to execute (HabitatClassification).
  • 3
    Am I correct in saying that "NETTesting.gdb_02_17_2018_11_29_23" is actually a folder and in that folder you have a file geodatabase called "NETTesting.gdb"? My gut feeling is not to have a folder name with a "." in it. – Hornbydd Feb 18 '18 at 2:35
  • @Hornbydd Yeah, you have it straight. The period was my initial thought too so i’ll try moving the NETTesting.gdb folder to a simpler named folder and see what happens. Can’t get rid of the period altogether though since the file geodatabase itself is a folder with a .gdb in the name, that’s why I’m not sure this’ll fix it. No harm in trying though, thanks for the input. – MKF Feb 18 '18 at 6:23
0

The fix for this is removing the period after all. I needed to unzip to a simplified directory.

End directory looked something like this: C:\Users\xxx\Desktop\GIS_NET_Testing\ArcObjectsTesting\ArcObjects\UploadedFiles\PA_02_17_2018_11_29_23\NETTesting.gdb\Patches

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.