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 12:37:58 EST 2002


husam <h.jehadalwan at student.kun.nl> wrote:
> Carel Fellinger wrote:
>> husam <h.jehadalwan at student.kun.nl> wrote:
...
>> var, what about trying it with `os.popen("/home/programs/profit", "w)'

> Off course, it works this way. But, then I have to execute another 
> script to process the output. Therefor I chosen for "popen2" so that I 
> can process the output in the same script.

Okee, so it works with lots of files and popen and fails for popen2.

A way to circumvent the problem then might be to use popen and redirect
the output to a temp file like:

    os.popen("/home/programs/profit >/tmp/tempfile", "w")

and read this file in the same srcipt when `profit' is done.

But this would deprive us from understanding what went wrong:)


>>     i = os.popen("/home/programs/profit ", "w")
>> 
>> Should this ---------------------------^ space be there?

> The space is needed here, otherwise the command and it's arguments 
> passed to the progam, get passed like this: "CommandArguments" instead 
> of " Command Arguments"

I don't get this.  All arguments to `/home/programs/profit' have to be
given in the popen* call.  I don't see arguments in that call so I
don't see need of the space here.  Or are you using a different script
than what you showed us here?  Even slight differences might be
relevant, so if you're running different sripts how about showing
them?

>>         i.write(" mobile /home/data/pdbs/" + PDB + "\n")
>> 
>> Should this -----^ space be there?

> The same explanation as above!

When you write to `i' you don't add arguments to the commandline used
to start `profit',  you're writing to the inputstream of `pdbs', quit a
different thing. So I still don't see the need for this space.



-- 
groetjes, carel



More information about the Python-list mailing list