[issue2947] subprocess (Replacing popen) - add a warning / hint

2009-06-08 Thread R. David Murray

R. David Murray  added the comment:

Applied (with spacing fix) in r73313.

--
resolution:  -> accepted
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2947] subprocess (Replacing popen) - add a warning / hint

2009-06-08 Thread Georg Brandl

Georg Brandl  added the comment:

Patch looks good, except for strange code indentation in the replaced
example.

--
assignee: georg.brandl -> r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2947] subprocess (Replacing popen) - add a warning / hint

2009-06-07 Thread R. David Murray

R. David Murray  added the comment:

Patch attached that adds an example that shows how to translate return
code handling, loosely based on Helmut's example.  I also turned the
function references in the section titles into links because I think
that would be very useful to someone wanting to do a translation
(provides easy access to the docs for the old functions).  The font size
looks a bit weird in the generated docs, though, so perhaps that is why
this wasn't done originally.  If putting references in section titles is
a no-no let me know and I'll remove them from the patch.

Also included in the patch is a fix for the cross reference link from
the os.spawn section to the 'replacing functions' section of the
subprocess docs.

--
keywords: +easy, patch
nosy: +r.david.murray
priority:  -> normal
stage:  -> patch review
type:  -> feature request
versions: +Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file14218/issue2947-doc.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2947] subprocess (Replacing popen) - add a warning / hint

2008-05-22 Thread Helmut Jarausch

New submission from Helmut Jarausch <[EMAIL PROTECTED]>:

Background:
I (as many others, too) have used the following code in the past

ARC='MyDumpFile'
tar_inp= os.popen('/bin/tar cjf '+ARC+' -T -','w')

tar_exit_code= tar_inp.close()
if  tar_exit_code != None and tar_exit_code % 256 :
  print "some error messages"

When replacing this - as suggested - by

TAR= Popen(('/bin/tar','cjf',ARC,'-T','-'),stdin=PIPE)
tar_inp= TAR.stdin

tar_inp.close() always returns None which was an indication
of NO ERROR when used together with popen.

So this has proabaly to be replaced by

tar_inp.close()
tar_exit_code= TAR.wait()

if  tar_exit_code != 0 :
  print "some error messages"


I suggest a warning / hint to change checking for errors
when upgrading to subprocess.Popen

--
assignee: georg.brandl
components: Documentation
messages: 67195
nosy: HWJ, georg.brandl
severity: normal
status: open
title: subprocess (Replacing popen) - add a warning / hint
versions: Python 2.6

__
Tracker <[EMAIL PROTECTED]>

__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com