Tkinter+popen4+windows leads to unwanted window

P

Patrick L. Nolan

We have a python+Tkinter program that works properly on
Linux, but when moved to Windows (XP) it behaves in a
strange way. There's a section like this:

(child_out, child_in) = popen2.popen4(cmd)
line = child_out.readline()
while line:
do_something_with(line)
line = child_out.readline()

The program named in the string cmd is a C++
application which writes lines of text to its
standard output.
The function do_something_with() displays the output
in a text window.

When I run this script on Windows XP with a recent
version of Active State python, nothing appears in
the text window. Instead a new command tool window
opens, and all the text appears there. When the
program (cmd) terminates, the command tool remains,
ready to accept commands. The Tkinter window locks
up, with its menu bar blanked out. The python
process burns 100% of the cpu time.

Apparently the child_out "file" returned by popen4
isn't really passing its data to the python script.
It seems to be going directly to a command tool,
and I would guess that readline() is in an infinite
loop.

Is there some way to deal with this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top