On Tuesday 22 Apr 2008 17:06:26 Paul Boddie wrote: > On 22 Apr, 12:52, Harishankar <[EMAIL PROTECTED]> wrote: > > Is there any way to use non-blocking Popen objects using subprocess? and > > 2 - is there a way to kill the subprocess in a platform independent > > manner in a purely Pythonic way? I thought initially that this problem is > > simple enough, but over the last couple of days I've been really > > struggling to find any answer. I've been through dozens of mailing list > > archives in to find a solution. Unfortunately none of the solutions seem > > to fit my needs. > > If you want some hints about using subprocesses with non-blocking I/O, > you might find some in my jailtools and pprocess projects: > > http://www.python.org/pypi/jailtools > http://www.python.org/pypi/pprocess > Thank you. I will take a look at those. Actually I feel a mechanism like this should be built-in to Python in the future.
> Although these projects involve things which are not exactly cross- > platform, the communications mechanisms should be portable, perhaps > with a bit of effort (since I don't recall whether the poll library > function is available on Windows, so you might have to use the select > function instead). It can be awkward sustaining non-blocking > communications with processes if they use buffered I/O, and the only > way I could make Python-based subprocesses work in jailtools was to > invoke them with the unbuffered option (-u). > > > My only solution seems to be to offer the end user the mencoder command > > line and make them execute it manually and be done with it but that seems > > a rather weak solution. > > The subprocess module may be an improvement over the popen2 module and > various os module functions, but it's still rather arcane. Yes. I am quite sure there must be an elegant solution to the subprocess handling/management. Problem is I've been at this for three days and I'm getting quite bleary eyed trying to pore through a lot of documentation ;-) -- Regards, V. Harishankar http://hari.literaryforums.org http://harishankar.org -- http://mail.python.org/mailman/listinfo/python-list