views:

67

answers:

1

I'm trying to capture the output of a windows program using Qt and Python.

I'm starting the process with QProcess, but the problem is the output is being buffered. Unfortunately I don't have access to the source, and therefore can't flush the output.

From my searching around, I found the program "Expect", but I don't know if there is a free Windows version floating around.

It would be nice to do it purely in python though.

A: 

Please take a look at QShared Memory http://doc.trolltech.com/main-snapshot/ipc-sharedmemory.html ... What you want to achieve is inter process communication, QShared memory works fine on Linux and Windows alike.

Ankur Gupta
Thank you. Could you please elaborate a little on how I would use QSharedMemory for this? I'm not sure how to get the QProcess to put anything in the shared memory.
Busk
I suggest you spend some time with existing QShared Memory example to get a grip on how it works. If you don't have a background of IPC, I suggest you read that first followed by shared memory. Then it will be easy to get a grip over the code snippet.
Ankur Gupta