output from another process to a textctrl via wxProcess

Hi, I have a separate process running using wxProcess. I want to have the output of said separate process appear in a text control in realtime eg. separate process outputs something and it appears (almost) instantaneously in the textctrl. I have tried the stuff in the demo. I am working on a sample app.

thanks

···


Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!

I've done something like this in one of my older blog posts:

Maybe that will help you out.

···

On Oct 21, 10:20 am, Micah Nordland <mpnordl...@gmail.com> wrote:

Hi, I have a separate process running using wxProcess. I want to have the
output of said separate process appear in a text control in realtime eg.
separate process outputs something and it appears (almost) instantaneously
in the textctrl. I have tried the stuff in the demo. I am working on a
sample app.
thanks

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

I had the second example working with subprocess and communicate, but as I understand it, communicate waits to return until the child process finishes. then I get the output, and it get’s displayed. It does not get displayed as the child process outputs it. The wx.Process demo responds immediately, but when I tried to copy and adapt the code, no output shows up at all. I know there’s a way, I just don’t know how to do it.

···


Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!

I had the second example working with subprocess and communicate, but as
I understand it, communicate waits to return until the child process
finishes. then I get the output, and it get's displayed. It does not get
displayed as the child process outputs it.

That is the way communicate() is designed to work. If you want to get output from the child as it is produced then you need to read from the Popen object's stdout file yourself. You can use functions in the select module to test if there is data available to be read on that file handle, or to wait until there is.

The wx.Process demo
responds immediately, but when I tried to copy and adapt the code, no
output shows up at all. I know there's a way, I just don't know how to
do it.

What are you doing differently than the demo's sample? Can you make a small runnable module that shows the problem you are having, so we can try it too?

···

On 10/21/10 10:33 AM, Micah Nordland wrote:

--
Robin Dunn
Software Craftsman

What are you doing differently than the demo’s sample? Can you make a small runnable module that shows the problem you are having, so we can try it too?

Basicly, I’m not doing it interactively, also, when I tried to put a different script into the demo, It’s output didn’t show up. However, I am more interested in reading the stdout myself, I assume you would just use the standard read() method? and how would I go about using the select module to check for data? This is for Linux, and the data I am getting from my child process is text.

···


Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!

Google should be able to turn up lots of examples of this. For example: python popen read select - Google Search

···

On 10/21/10 11:07 AM, Micah Nordland wrote:

>What are you doing differently than the demo's sample? Can you make a
small runnable module that shows the problem you are having, so we can
try it too?

Basicly, I'm not doing it interactively, also, when I tried to put a
different script into the demo, It's output didn't show up. However, I
am more interested in reading the stdout myself, I assume you would just
use the standard read() method? and how would I go about using the
select module to check for data? This is for Linux, and the data I am
getting from my child process is text.

--
Robin Dunn
Software Craftsman

ok, thanks

···


Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!