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

2007-06-13 Thread SourceForge.net
Bugs item #1736483, was opened at 2007-06-13 13:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
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.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1736483&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1712522 ] urllib.quote throws exception on Unicode URL

2007-06-13 Thread SourceForge.net
Bugs item #1712522, was opened at 2007-05-04 06:11
Message generated for change (Comment added) made by varmaa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1712522&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: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: John Nagle (nagle)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.quote throws exception on Unicode URL

Initial Comment:
The code in urllib.quote fails on Unicode input, when
called by robotparser with a Unicode URL.

Traceback (most recent call last):
File "./sitetruth/InfoSitePage.py", line 415, in run
pagetree = self.httpfetch() # fetch page
File "./sitetruth/InfoSitePage.py", line 368, in httpfetch
if not self.owner().checkrobotaccess(self.requestedurl) : # if access 
disallowed by robots.txt file
File "./sitetruth/InfoSiteContent.py", line 446, in checkrobotaccess
return(self.robotcheck.can_fetch(config.kuseragent, url)) # return can fetch
File "/usr/local/lib/python2.5/robotparser.py", line 159, in can_fetch
url = urllib.quote(urlparse.urlparse(urllib.unquote(url))[2]) or "/"
File "/usr/local/lib/python2.5/urllib.py", line 1197, in quote
res = map(safe_map.__getitem__, s)
KeyError: u'\xe2'

   That bit of code needs some attention.  
- It still assumes ASCII goes up to 255, which hasn't been true in Python for a 
while now.
- The initialization may not be thread-safe; a table is being initialized on 
first use.

"robotparser" was trying to check if a URL with a Unicode character in it was 
allowed.  Note the "KeyError: u'\xe2'" 

--

Comment By: Atul Varma (varmaa)
Date: 2007-06-13 15:36

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

It should be noted that the unicode aspect of this bug is actually a
recognized flaw with a nontrivial solution.  See this thread from the
Python-dev list, dated from July 2006:

http://mail.python.org/pipermail/python-dev/2006-July/067248.html

It was essentially agreed upon in this thread that the "obvious"
solution--simply converting to UTF-8 as per rfc3986--doesn't actually cover
all cases, and that passing a unicode string in to urllib.quote() indeed
has ambiguous results.  For more information, see Mike Brown's comment on
the aforementioned thread:

http://mail.python.org/pipermail/python-dev/2006-July/067335.html

It was generally agreed in the thread that the proper solution was to have
urllib.quote() *only* deal with standard Python string data, and to raise a
TypeError if a unicode string is passed in, implying that any conversion
needs to be done by higher-level code, because implicit conversion within
urllib.quote() is too ambiguous.

However, it seems the TypeError fix was never made to the Python SVN
repository; perhaps this is because it may have broken legacy code that
actually catches KeyErrors as John Nagle mentioned?  Or perhaps it was
simply because no one ever got around to it.  Unfortunately, I'm not in a
position to say for sure, but I hope my explanation helps.


--

Comment By: John Nagle (nagle)
Date: 2007-06-06 16:49

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

As a workaround, you can surround calls to "can_fetch" with an try-block
and catch KeyError exceptions.  That's what I'm doing.  

--

Comment By: Collin Winter (collinwinter)
Date: 2007-06-05 23:39

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

Could you possibly provide a patch to fix this?

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1712522&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
Bugs item #1736483, was opened at 2007-06-13 09:41
Message generated for change (Comment added) made by ilgiz
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: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 13: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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1581906 ] test_sqlite fails on OSX G5 arch if test_ctypes is run

2007-06-13 Thread SourceForge.net
Bugs item #1581906, was opened at 2006-10-21 13:02
Message generated for change (Comment added) made by incongruity
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1581906&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.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Skip Montanaro (montanaro)
Assigned to: Skip Montanaro (montanaro)
Summary: test_sqlite fails on OSX G5 arch if test_ctypes is run

Initial Comment:
I noticed a test_sqlite test failure on my Mac G5 the other day while trying 
to set up a buildbot for sqlalchemy.  Everything runs fine on my G4 
powerbook.  Both machines run Mac OSX 10.4.8 with Apple's gcc 4.0.0, 
build 5026.

I whittled the problem down to just having test_ctypes and test_sqlite 
enabled, then further whittled it down to just having Lib/ctypes/test/
test_find.py available (all other ctypes tests eliminated).  More detailed 
problem descriptions are in these two postings to python-dev:

http://article.gmane.org/gmane.comp.python.devel/84478
http://article.gmane.org/gmane.comp.python.devel/84481

Skip


--

Comment By: ted pollari (incongruity)
Date: 2007-06-13 15:19

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

FWIW, I'm getting an identical error on a MacBook Pro with a Core Duo
processor

--

Comment By: Thomas Heller (theller)
Date: 2007-05-04 09:04

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

FYI, this PyOpenGL bug may be related:

https://sourceforge.net/tracker/?func=detail&atid=105988&aid=1712741&group_id=5988

--

Comment By: Thomas Heller (theller)
Date: 2007-03-22 15:18

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

Skip,

I do not have a G5 machine available, only a G4 and the problem doesn't
appear there.
For someone with a G5 it should not be too difficult to reproduce (or
investigate),
I think that running './python Lib/test/regrtest.py test_ctypes
test_sqlite' should suffice.

However, if loading the GLUT library changes the cwd, and sqlite fails
with a changed working dir,
I'm not sure where the problem really is and how it should be fixed.  It
could be said that test_ctypes
should restore the cwd after the tests (but maybe this should be done by
the test framework?),
or it could be said that test_sqlite should set the cwd in case the test
relies on it.

I'll assign back to you because I have no way to test it on a machine
where the problem appears.

--

Comment By: Skip Montanaro (montanaro)
Date: 2007-03-18 12:20

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

Thomas, I assigned this to you simply so you can cast your eye on the
problem and see if you think there might be anything ctypes-related in the
problem I've reported.  I've ignored it up 'til now, but I bumped up
against it again trying to get the Pybots SQLAlchemy test suite running on
my Mac.  During my previous encounter with this problem Ronald Oussouren
reported on a possible connection with GLUT:

http://mail.python.org/pipermail/python-dev/2006-October/069523.html

Assuming there is no obvious ctypes connection you can determine  (it's
not clear to me that there is any current directory funny business going
on) just assign it back to me and I'll try to find a pysqlite expert to
take a look.

Thx,

Skip


--

Comment By: Skip Montanaro (montanaro)
Date: 2006-10-21 13:04

Message:
Logged In: YES 
user_id=44345

Another article here:

http://article.gmane.org/gmane.comp.python.devel/84487


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1581906&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1736792 ] dict reentrant/threading bug

2007-06-13 Thread SourceForge.net
Bugs item #1736792, was opened at 2007-06-13 16:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1736792&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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Adam Olsen (rhamphoryncus)
Assigned to: Nobody/Anonymous (nobody)
Summary: dict reentrant/threading bug

Initial Comment:
As I first mentioned in my post[1] on comp.lang.python, it seems possible to 
modify a dict while a lookup is ongoing, without causing the lookup to restart. 
 This requires the ma_table be reallocated twice (first to a new address, then 
a second time back to the original address).  This could also happen if the 
constants or behaviour relating to ma_smalltable were changed, but the current 
implementation is safe.

To fix this, I suggest two more tests be added along side the ep0 and startkey 
tests that currently restart the lookup process.

1) ma_mask.  If ma_table was reallocated, and the new allocation is smaller, 
memory corruption would result.  Checking ma_mask for changes would ensure this 
doesn't happen.

2) reallocation counter.  Increment every time ma_table is reallocated.  It 
would be technically possible to overflow this, but the circumstances would be 
exceedingly unusual.


[1] 
http://groups.google.com/group/comp.lang.python/browse_thread/thread/7f5b8fc59aadbdea/d77bdbcf5b20c056

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1736792&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
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 "", 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 "", 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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
Bugs item #1736483, was opened at 2007-06-13 09:41
Message generated for change (Comment added) made by ilgiz
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: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 22:24

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

I've realized my suggestion was not precise.  I meant asking to run the
argument to popen() rather than popen().

That is, I would run this from command line to see if there is an issue
with the shell:

$ yes | echo hello



--

Comment By: Eric (cpegeric)
Date: 2007-06-13 21: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 "", 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 "", line 1, in ?
KeyboardInterrupt



--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 13: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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
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 02:46

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

sorry for the misunderstanding.

Here is the result. 

% yes | echo hello
hello
% echo $?
0
%

--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-14 02:24

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

I've realized my suggestion was not precise.  I meant asking to run the
argument to popen() rather than popen().

That is, I would run this from command line to see if there is an issue
with the shell:

$ yes | echo hello



--

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 "", 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 "", 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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
Bugs item #1736483, was opened at 2007-06-13 09:41
Message generated for change (Comment added) made by ilgiz
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: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 23:15

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


It appears your "yes" does not catch SIGPIPE.  I've reproduced the issue
with

$ python -c 'import sys, os; sys.stdout.write(os.popen("while :; do echo
yes ; done | echo hello").read())'
Traceback (most recent call last):
  File "", line 1, in 
KeyboardInterrupt

The documentation on Python module signal says SIGPIPE is ignored by
Python as well.  My work-around to this was to catch SIGPIPE, but the GNU C
library would terminate the whole script.

$ python -c 'import sys, os, signal; signal.signal(signal.SIGPIPE,
signal.SIG_DFL); sys.stdout.write(os.popen("while :; do echo yes ; done |
echo hello").read())'
hello

http://www.gnu.org/software/libc/manual/html_node/Operation-Error-Signals.html

Perhaps, writing own signal handler might help.


--

Comment By: Eric (cpegeric)
Date: 2007-06-13 22:46

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

sorry for the misunderstanding.

Here is the result. 

% yes | echo hello
hello
% echo $?
0
%

--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 22:24

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

I've realized my suggestion was not precise.  I meant asking to run the
argument to popen() rather than popen().

That is, I would run this from command line to see if there is an issue
with the shell:

$ yes | echo hello



--

Comment By: Eric (cpegeric)
Date: 2007-06-13 21: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 "", 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 "", line 1, in ?
KeyboardInterrupt



--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 13: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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
Bugs item #1736483, was opened at 2007-06-13 09:41
Message generated for change (Comment added) made by ilgiz
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: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 23:22

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

The SIG_DFL default handler seems to terminate the current process
(argument to popen()), not Python script.


--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 23:15

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


It appears your "yes" does not catch SIGPIPE.  I've reproduced the issue
with

$ python -c 'import sys, os; sys.stdout.write(os.popen("while :; do echo
yes ; done | echo hello").read())'
Traceback (most recent call last):
  File "", line 1, in 
KeyboardInterrupt

The documentation on Python module signal says SIGPIPE is ignored by
Python as well.  My work-around to this was to catch SIGPIPE, but the GNU C
library would terminate the whole script.

$ python -c 'import sys, os, signal; signal.signal(signal.SIGPIPE,
signal.SIG_DFL); sys.stdout.write(os.popen("while :; do echo yes ; done |
echo hello").read())'
hello

http://www.gnu.org/software/libc/manual/html_node/Operation-Error-Signals.html

Perhaps, writing own signal handler might help.


--

Comment By: Eric (cpegeric)
Date: 2007-06-13 22:46

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

sorry for the misunderstanding.

Here is the result. 

% yes | echo hello
hello
% echo $?
0
%

--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 22:24

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

I've realized my suggestion was not precise.  I meant asking to run the
argument to popen() rather than popen().

That is, I would run this from command line to see if there is an issue
with the shell:

$ yes | echo hello



--

Comment By: Eric (cpegeric)
Date: 2007-06-13 21: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 "", 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 "", line 1, in ?
KeyboardInterrupt



--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-13 13: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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2007-06-13 Thread SourceForge.net
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 03:49

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

It works now. thank you.

--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-14 03:22

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

The SIG_DFL default handler seems to terminate the current process
(argument to popen()), not Python script.


--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-14 03:15

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


It appears your "yes" does not catch SIGPIPE.  I've reproduced the issue
with

$ python -c 'import sys, os; sys.stdout.write(os.popen("while :; do echo
yes ; done | echo hello").read())'
Traceback (most recent call last):
  File "", line 1, in 
KeyboardInterrupt

The documentation on Python module signal says SIGPIPE is ignored by
Python as well.  My work-around to this was to catch SIGPIPE, but the GNU C
library would terminate the whole script.

$ python -c 'import sys, os, signal; signal.signal(signal.SIGPIPE,
signal.SIG_DFL); sys.stdout.write(os.popen("while :; do echo yes ; done |
echo hello").read())'
hello

http://www.gnu.org/software/libc/manual/html_node/Operation-Error-Signals.html

Perhaps, writing own signal handler might help.


--

Comment By: Eric (cpegeric)
Date: 2007-06-14 02:46

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

sorry for the misunderstanding.

Here is the result. 

% yes | echo hello
hello
% echo $?
0
%

--

Comment By: Ilguiz Latypov (ilgiz)
Date: 2007-06-14 02:24

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

I've realized my suggestion was not precise.  I meant asking to run the
argument to popen() rather than popen().

That is, I would run this from command line to see if there is an issue
with the shell:

$ yes | echo hello



--

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 "", 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 "", 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
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com