2

Can a Python script be executed from a .NET AddIn and also write its standard output and geoprocessor message to the ArcMap Python Window?

I have no problem call python scripts with Process.Start or GeoProcessorClass.Execute. But I have an existing AddIn (10.1) and I want to add a new button that will call the python script and have it behave the same way a right-click Load... behaves in the ArcMap python window.

Is there a way to do this?

I'm currently using this procedure.

And it does run the script--I'm just after the same out to the python window.

3

No, it's not possible. The .Net parts of your code can't talk to the Python window.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • Years ago I tried to see if I could import arcgisscripting into IronPython (Python's .NET version) - Fail :( I never tried with ArcPy and don't have a version to hand. It's not likely... but who knows... worth a try for all of the 5 seconds it would take? – MappaGnosis Aug 3 '13 at 7:11
2

You could create your own logging window. See the Simple logging dockable window with a custom context menu sample for a starting point. From there you would need to simply get the messages from your GP result object and add them to the log window.

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.