1

I am writing a python script to configure a storage array. I am making a frontend for it in Visual Studio 2010 using C#. I'd like to have the python script run within a textbox in the c# GUI rather than in a seperate DOS window. I'd also like the responses from the python script to be visible within the textbox in realtime. Can this be done?

Basically, I'd like it all to be contained within my c# window and not open any seperate windows when the script kicks off. Once the user hits Submit and it kicks off the script, all data will be read in from an XML file so I won't need to take any input in through the textbox, I just want the output to appear there so the user knows whats happening rather than the window just hanging until the script is complete. Thanks!

knoxvillain
  • 83
  • 1
  • 1
  • 3

2 Answers2

2

I think this post will get you started.

enter image description here

Jake Pearson
  • 27,069
  • 12
  • 75
  • 95
  • Hi Jake, Thanks for that. Unfortunately my python script will use paramiko and pycrypto so I don't think I can use IronPython for it. – knoxvillain Nov 02 '11 at 10:11
0

You could run it in a hidden console window and capture the output it generates

Capturing console output from a .NET application (C#)

Community
  • 1
  • 1
Peter
  • 37,042
  • 39
  • 142
  • 198
  • Hi petoj, this is how I am doing it at the moment however while the script is running the GUI I've made in c# hangs until the script is finished. I'd like to be able to print stuff on screen to alerts the user to how things are progressing. I think i need to run the script in a seperate thread or something? – knoxvillain Nov 04 '11 at 14:59
  • Try changing your logic so that it does use some sort of read async instead of read to end, that way your application will not hang... the reason it hags is becures your occupying the GUI thread until the console application is done.. – Peter Nov 07 '11 at 07:00