[Tutor] subprocess.Popen basics

Adam Jensen hanzer at riseup.net
Mon Oct 27 21:26:22 CET 2014


On 10/27/2014 03:40 PM, David Abbott wrote:
>> It hangs at the print statement and, from the sound of the fans in the
>> computer, I suspect it spirals off into an infinite loop somewhere /
>> somehow. Does anyone have any ideas about what it is that I might be
>> misunderstanding?
> 
> Works here.
> 
> david at heater ~/python_practice $ ./subprocess_pipe.py
> Parrot said:  Squawk: Pushing up daisies.
> 
> david at heater ~/python_practice $ python
> Python 3.3.5 (default, Oct  2 2014, 07:55:01)
> [GCC 4.7.3] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> quit()
> 

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:

Python 3.4.1 (default, Jun 20 2014, 01:51:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux

Python 3.4.1 |Anaconda 2.1.0 (32-bit)| (default, Sep 10 2014, 17:21:42)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux

$ ./subprocess_pipe.py
# It hangs here until Ctrl-c
^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