Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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

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