mkosior

Geoprocessing COMException when running my own script.

Discussion created by mkosior on Jul 4, 2012
Latest reply on Apr 3, 2013 by mkosior
Hi,
I have searched a lot of forums looking for answers but none have helped so far. 
I am trying to run my own script ( a dummy empty one for now) with geoprocessing in Visual studio 2010 using c# and ArcDesktop 10.  When I ran this with the "Buffer_analysis" built in tool and some different parameters it worked fine.  When I run my own script (which i know it sees as i print the tools out) i can't even get gp.GetMessage(0) error messages, they just come up blank.

Here is my c#.net code:
using ESRI.ArcGIS.Geoprocessing;

GeoProcessor gp = new GeoProcessor();

ESRI.ArcGIS.esriSystem.AoInitialize ao = null;
try
{
    RuntimeManager.Bind(ProductCode.Desktop);
    ao = new AoInitializeClass();
    esriLicenseStatus licStatus = ao.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);  //Ive also tried arcEditor liscence
    ao.CheckOutExtension(esriLicenseExtensionCode.esriLicenseExtensionCode3DAnalyst);
    Debug.WriteLine("License Checkout successful.");

gp.OverwriteOutput = true;
gp.AddToolbox(@"C:\MyToolbox.tbx");

IGpEnumList tools = gp.ListTools("*");
string tool = tools.Next();
while (tool != "")
{
     Debug.WriteLine(tool);
     tool = tools.Next();
}
IVariantArray parameters = new VarArrayClass();
parameters.Add(@"C:\Custom_Menu\shape.shp");
gp.Execute("test", parameters, null);//*********************************this gives the error***************************************
...
}
catch... Debug.WriteLine(gp.GetMessage(0))



Here is my "test.py" script:

# Import arcpy module
import arcpy, os
from arcpy import env

arcpy.AddMessage( "\nDone")


I don't get it.  Please help...

Outcomes