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.

2 Answers 2

3

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

1
  • 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? Commented Aug 3, 2013 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 and acknowledge you have read our privacy policy.

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