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

husam h.jehadalwan at student.kun.nl
Fri Feb 22 17:48:25 EST 2002


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())".




More information about the Python-list mailing list