[Tutor] subprocess.Popen basics

Adam Jensen hanzer at riseup.net
Tue Oct 28 02:50:39 CET 2014


On 10/27/2014 09:31 PM, Alan Gauld wrote:
> On 27/10/14 20:26, Adam Jensen wrote:
> 
>> That's a bit bizarre. I too have the execution bit set for both the
>> python script and the shell script but the same (no joy) behavior occurs
>> on both:
> 
>> $ ./subprocess_pipe.py
> 
> Its a long shot but try explicitly invoking the interpreter:
> 
> $ python3 ./subprocess_pipe.py
> 
> The shebang line should make in unnecessary but you
> never know...
> 

What's weird is that I have two different python3.4 installations on
this CentOS-6.5 machine and both have the same behavior (script hangs
until Ctrl+C).

I built this one (/opt/bin/python3.4) from source:

$ /opt/bin/python3.4 subprocess_pipe.py
^CTraceback (most recent call last):
  File "subprocess_pipe.py", line 10, in <module>
    print('Parrot said: ', parrot.stdout.readline())
KeyboardInterrupt


But this one (~/anaconda3/bin/python3.4) was a binary distribution (if I
recall correctly):

$ ~/anaconda3/bin/python3.4 subprocess_pipe.py
^CTraceback (most recent call last):
  File "subprocess_pipe.py", line 10, in <module>
    print('Parrot said: ', parrot.stdout.readline())
KeyboardInterrupt



More information about the Tutor mailing list