[Chicago] Wrapping an interactive console application

Pete pfein at pobox.com
Mon Apr 21 21:27:37 CEST 2008


On Apr 21, 2008, at 2:33 PM, Feihong Hsu wrote:

> Hi everyone,
>
> Is there anyone here who has experience with the following problem? I
> am trying to write a Python program that wraps around an interactive
> console application. I use the subprocess module for this. I start a
> separate thread which uses the Popen.stdout attribute to get the
> output from the console application. Everything basically works OK,
> except that I can't easily quit my Python program. Even calling
> sys.exit doesn't work! It looks like my thread that's reading from
> standard output just refuses be killed.

I don't know what your app is doing, but you don't need to a thread to  
avoid blocking on the subprocess:

http://ivory.idyll.org/blog/apr-08/threading-and-subprocess.html

-- 
Pete
pfein at pobox.com






More information about the Chicago mailing list