Python, Tkinter and popen problem

norseman norseman at hughes.net
Mon Jun 1 19:24:28 EDT 2009


MRAB wrote:
> norseman wrote:
>> Piet van Oostrum wrote:
>>> norseman <norseman at hughes.net> (n) wrote:
> [snip]
>>>> n> Some questions:
>>>> n>     1) "...], stdout=PIPE).stdout
>>>> n>                    ^            ^  why the double use?
>>>
>>> It is not a double use. Popen(["z6.py"], stdout=PIPE) gives you a Popen
>>> object, not a file object. If you add .stdout you get the stdout
>>> attribute of the Popen object of which you just before stated that it
>>> should be a pipe. So the stdout=PIPE parameter makes it create a pipe,
>>> and the .stdout returns you that pipe.
>>>
>>
>> I rather thought it might be something like the military:
>> Company - Dress Right - Dress
>> Get the attention, state what is to be done, order it done. :)
>>
>> Python goes to great lengths to "be helpful" but drops the ball on the 
>> obvious.  stdout=PIPE means the user wants stdout piped back so it 
>> should be helpful and do the obvious rather than have the user be 
>> redundant.
>>
> What if the user requests both stdin and stdout? and what about all the
> other useful bits which the returned object provides?

---------------------------
"... stdin and stdout?..."
   I tried that - results were even worse.  Have to kill the window to 
get out.  (both redirects are to master who is not running, until child 
dies. meanwhile keyboard is effectively locked out)

"... other useful bits..."
   Beauty is in the eye of the beholder. Or so the saying goes.
   "Useful" to one may not be so to another.  It is kinda like this:
I have been in some beautifully painted cars. Really great workmanship. 
They had lots of 'extras' too. Soft leather seats, built in two way 
radios and built in mobile phones and built in ice makers and the list 
goes on.  But in the USofA Western States that have lots of dirt and 
gravel roads they are a complete waste of time, effort and money. Two 
weeks and they look like any other beat up jalopy.  The dust gets into 
everything.  Ever wanted to put ice cubes full of frozen dust and grit 
into your favorite drink?  The ice maker had been installed into a 
friend's old pickup a week or so earlier. A month or so later I noticed 
it had been removed.  "Useful" is a vague measurement at best.


By the way - bits and pieces as told by yourself and Peter and Piet have 
accomplished painting a useful picture for me.

My thanks to all three of you.


Steve



More information about the Python-list mailing list