homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess lib - opening same command fails
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: gregory.p.smith, gtg944q
Priority: normal Keywords:

Created on 2008年07月10日 18:21 by gtg944q, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
subprocess-isue3335.py gregory.p.smith, 2008年07月14日 06:19
Messages (4)
msg69514 - (view) Author: Justin Harper (gtg944q) Date: 2008年07月10日 18:21
When I make the same shell call a second time, a weird error occurs. 
It appears that the system is caching the call and then returning the 
same object the second time, which causes a problem because the stream 
is at EOF and there is no way to seek on this sort of file object.
Code:
 fout = subprocess.Popen("owplaces -silent -multi", shell=True, 
stdout=subprocess.PIPE).stdout
 self.output = fout.read()
 
 if self.output != []:
 for line in self.output:
 print line
 
 fout.close()
Error:
Traceback (most recent call last):
 File "./saveSettings.py", line 30, in next_page
 func()
 File "./saveSettings.py", line 62, in save_startup
 fout = subprocess.Popen("owplaces -silent -multi", shell=True, 
stdout=subprocess.PIPE).stdout
 File "/opt/app/g++lib6/python-2.4/lib/python2.4/warnings.py", line 
61, in warn
 warn_explicit(message, category, filename, lineno, module, registry)
 File "/opt/app/g++lib6/python-2.4/lib/python2.4/warnings.py", line 
82, in warn_explicit
 for item in filters:
TypeError: an integer is required
The first time the code works time. The second (and subsequent times) 
the cryptic error msg is displayed.
Python 2.4.5 running on a Solaris machine.
msg69515 - (view) Author: Justin Harper (gtg944q) Date: 2008年07月10日 18:22
Correction: line two should actually be:
self.output = fout.readlines()
The bug still exists with this change.
msg69645 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2008年07月14日 06:19
I am unable to reproduce this (using release24-maint on OS X 10.4). the
script I used is attached.
Does this script fail for you? If not, please upload something that fails.
msg69652 - (view) Author: Justin Harper (gtg944q) Date: 2008年07月14日 13:26
Further research reveals that the problem appears to be with the 
gtk.Assistant class in PyGTK 2.10, not the subprocess lib.
Report can be closed.
History
Date User Action Args
2022年04月11日 14:56:36adminsetgithub: 47585
2008年07月14日 13:35:54benjamin.petersonsetstatus: open -> closed
resolution: not a bug
2008年07月14日 13:26:34gtg944qsetmessages: + msg69652
2008年07月14日 06:19:19gregory.p.smithsetfiles: + subprocess-isue3335.py
nosy: + gregory.p.smith
messages: + msg69645
2008年07月10日 18:22:58gtg944qsetmessages: + msg69515
2008年07月10日 18:21:48gtg944qcreate

AltStyle によって変換されたページ (->オリジナル) /