Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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, os
from arcpy import env

arcpy.AddMessage( "\nDone")

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

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.