is their any limit on the size of the data passed to a progra m via popen2?

Gustavo Cordova gcordova at hebmex.com
Fri Feb 22 17:45:29 EST 2002


Yeah, Jeff Shannon wrote something about
pipes hanging in a .read() operation. :-/

So... any other clues yet?

-gus

> -----Original Message-----
> From: husam [mailto:h.jehadalwan at student.kun.nl]
> Sent: Viernes, 22 de Febrero de 2002 04:48 p.m.
> To: python-list at python.org
> Subject: Re: is their any limit on the size of the data passed to a
> progra m via popen2?
> 
> 
> Gustavo Cordova wrote:
> 
> >>  pdbdir = os.popen('ls /home/data/pdbs') # if this directory 
> >>contains 
> >>10000 files, the code does not work.
> >>
> >>files=pdbdir.readlines()
> >>pdbdir.close()
> >>(o,i) = popen2.popen2("/home/programs/profit ")
> >>
> >>i.write("reference /usr/local/3D_Dock/progs/Complex_1g.pdb ") 
> >># This the 
> >>reference molecule.
> >>
> >>for PDB in files:
> >>     i.write(" mobile /home/data/pdbs/" + PDB + "\n") # A new 
> >>molecule.
> >>     i.write("fit\n")		# compares reference 
> and new molecules.
> >>
> >>i.close()
> >>result= o.read()
> >>o.close()
> >>
> >>
> > 
> > You read from the input pipe only upon writing all your data,
> > but maybe the pipe is full?
> > 
> > How about changing the loop with this:
> > 
> > 
> > log = StringIO.StringIO()
> > 
> > for PDB in files:
> >   i.write("mobile /home/data/pdbs/%s\n" % PDB)
> >   i.write("fit\n")
> >   log.write(o.read())
> > 
> > i.close()
> > o.close()
> > 
> > 
> > So now your results are in the log object.
> > 
> > -gus
> > 
> > 
> 
> hi Gustaveo,
> You'r solution did not work either. The code hangs at the first loop, 
> specifically at "log.write(o.read())".
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list