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.

Jay Cummins
  • 14,642
  • 7
  • 66
  • 141

2 Answers2

3

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

Jason Scheirer
  • 18,002
  • 2
  • 53
  • 72
  • 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 03 '13 at 07: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.

blah238
  • 35,793
  • 7
  • 94
  • 195