Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

subprocess - please enhance the documentation

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


jarausch at igpm

May 20, 2008, 3:18 AM

Post #1 of 2 (24 views)
Permalink
subprocess - please enhance the documentation

Hi,

I'd like to suggest to add a few lines to chapter 17.1.3.5 "Replacing os.popen"
(Python Doc 2.5.2)

I 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.

So I have replaced this by

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

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


Perhaps a few lines telling about this would be helpful.

Thanks,
Helmut.

--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
--
http://mail.python.org/mailman/listinfo/python-list


tjreedy at udel

May 20, 2008, 10:43 AM

Post #2 of 2 (19 views)
Permalink
Re: subprocess - please enhance the documentation [In reply to]

"Helmut Jarausch" <jarausch[at]igpm.rwth-aachen.de> wrote in message
news:69fmseF329s6vU1[at]mid.dfncis.de...
| Hi,
|
| I'd like to suggest to add a few lines to chapter 17.1.3.5 "Replacing
os.popen"
| (Python Doc 2.5.2)

1. Take a look at the existing 2.6 manual (on Python.org) to make sure it
has not already been improved. If not..

2. Post your suggestions on bugs.python.org and mark the item as
documentation and stdlib. Suggest the specific addition or change you
would like to see. If accepted, one of the doc-masters with add it with
the needed formatting code and possibly stylistic changes.

| I 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.
|
| So I have replaced this by
|
| tar_inp.close()
| tar_exit_code= TAR.wait()
|
| if tar_exit_code != 0 :
| print "some error messages"
|
|
| Perhaps a few lines telling about this would be helpful.
|
| Thanks,
| Helmut.
|
| --
| Helmut Jarausch
|
| Lehrstuhl fuer Numerische Mathematik
| RWTH - Aachen University
| D 52056 Aachen, Germany
| --
| http://mail.python.org/mailman/listinfo/python-list
|



--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.