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

Carel Fellinger cfelling at iae.nl
Sat Feb 23 01:34:49 CET 2002


husam <h.jehadalwan at student.kun.nl> wrote:

> hi Gustaveo,
> You'r solution did not work either. The code hangs at the first loop, 
> specifically at "log.write(o.read())".

You don't seem to be having a Python problem, so what about trying to
get some output from the program?  Instead of reading the log into a
var, what about trying it with `os.popen("/home/programs/profit", "w)'
and have the output directed at the terminal for direct inspection.
Maybe you're just missing error messages:)

An other problem that might buck you (but I don't see how this would
be the case as your program seems to work for a few files) is that
pipes are buffered.  So uses `i.flush()' to be sure that what you
wrote really is transmitted to the other end of the pipe.

And as a last resort you could try reading the `ls' output a line at a
time.

    i = os.popen("/home/programs/profit ", "w")

Should this ---------------------------^ space be there?

    i.write("reference /usr/local/3D_Dock/progs/Complex_1g.pdb ") 
    for PDB in os.popen('ls /home/data/pdbs'):
        i.write(" mobile /home/data/pdbs/" + PDB + "\n")

Should this -----^ space be there?

        i.write("fit\n")
        i.flush()
    i.close()
-- 
groetjes, carel



More information about the Python-list mailing list