[ python-Bugs-1736483 ] os.popen('yes | echo hello') stuck

SourceForge.net noreply at sourceforge.net
Thu Jun 14 03:28:45 CEST 2007


Bugs item #1736483, was opened at 2007-06-13 13:41
Message generated for change (Comment added) made by cpegeric
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1736483&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Eric (cpegeric)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.popen('yes | echo hello') stuck

Initial Comment:
after calling os.popen('yes | echo hello'), the process never returns.

----------------------------------------------------------------------

>Comment By: Eric (cpegeric)
Date: 2007-06-14 01:28

Message:
Logged In: YES 
user_id=1595194
Originator: YES

command line also get stuck.  The OS is MacOSX.  Python version 2.3.5. 
Will it help update to new version?

I quited the program by Ctrl-C.

 python -c 'import sys, os; sys.stdout.write(os.popen("yes | echo
hello").read())'
^CTraceback (most recent call last):
  File "<string>", line 1, in ?
KeyboardInterrupt



% python -c 'import sys, os; sys.stdout.write(os.popen3("yes | echo
hello")[1].read())'
^CTraceback (most recent call last):
  File "<string>", line 1, in ?
KeyboardInterrupt



----------------------------------------------------------------------

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 17:07

Message:
Logged In: YES 
user_id=281701
Originator: NO


Could you try the same command from your shell?

I am guessing "yes" will write an error message about the broken pipe to
stderr.

$ python -c 'import sys, os; sys.stdout.write(os.popen("yes | echo
hello").read())'
yes: standard output: Broken pipe
yes: write error
hello

$ python -c 'import sys, os; sys.stdout.write(os.popen3("yes | echo
hello")[1].read())'
hello


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1736483&group_id=5470


More information about the Python-bugs-list mailing list