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 18:59:14 CET 2002


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




More information about the Python-list mailing list