Re: Subprocess with a Python Session?

2006-12-09 Thread Hendrik van Rooyen
Paul Boddie [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Paul Boddie wrote: This is one of the more reliable methods since upon receiving a packet delimiter the receiver knows that the data is complete. and for people who want strongRELIABLE/strong and not just at least not

Re: Subprocess with a Python Session?

2006-12-08 Thread Paul Boddie
Hendrik van Rooyen wrote: Giovanni Bajo [EMAIL PROTECTED] Yeah, but WHY was the API designed like this? Why can't I read and write freely from a pipe connected to a process as many times as I want? you can - all you have to do is to somehow separate the records - else how is the

Re: Subprocess with a Python Session?

2006-12-08 Thread Fredrik Lundh
Paul Boddie wrote: This is one of the more reliable methods since upon receiving a packet delimiter the receiver knows that the data is complete. and for people who want strongRELIABLE/strong and not just at least not entirely unreliable, there's always:

Re: Subprocess with a Python Session?

2006-12-08 Thread Paul Boddie
Fredrik Lundh wrote: Paul Boddie wrote: This is one of the more reliable methods since upon receiving a packet delimiter the receiver knows that the data is complete. and for people who want strongRELIABLE/strong and not just at least not entirely unreliable, there's always:

Re: Subprocess with a Python Session?

2006-12-07 Thread Giovanni Bajo
Fredrik Lundh wrote: No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import subprocess p = subprocess.Popen(python, stdout=subprocess.PIPE,

Re: Subprocess with a Python Session?

2006-12-07 Thread Paul Boddie
Shane Hathaway wrote: Make sure the pipes are unbuffered. Launch the process with python -u and flush() the streams after writing. (That's the issue I've encountered when doing this before.) The -u option is critical, yes. I wrote some code recently which communicated with a subprocess

Re: Subprocess with a Python Session?

2006-12-07 Thread El Pitonero
Paul Boddie wrote: Shane Hathaway wrote: Make sure the pipes are unbuffered. Launch the process with python -u and flush() the streams after writing. (That's the issue I've encountered when doing this before.) The -u option is critical, yes. I wrote some code recently which

Re: Subprocess with a Python Session?

2006-12-07 Thread Fredrik Lundh
Giovanni Bajo wrote: assert p.stdout.readline() == '10\n' Yeah, but WHY was the API designed like this? Why can't I read and write freely from a pipe connected to a process as many times as I want? the subprocess module is designed to deal with Unix-style subprocesses in general, not

Re: Subprocess with a Python Session?

2006-12-07 Thread Gabriel Genellina
At Thursday 7/12/2006 12:16, El Pitonero wrote: Is there something equivalent to the -u option for a shell like bash? In general (whether the subprocess is bash or python), how can one make sure that once something is written into the subprocess' stdin, the output from its stdout is fully

Re: Subprocess with a Python Session?

2006-12-07 Thread Hendrik van Rooyen
Giovanni Bajo [EMAIL PROTECTED] Fredrik Lundh wrote: No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import subprocess p =

Subprocess with a Python Session?

2006-12-05 Thread Calvin Spealman
No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import subprocess p = subprocess.Popen(python, stdout=subprocess.PIPE, stdin=subprocess.PIPE)

Re: Subprocess with a Python Session?

2006-12-05 Thread Fredrik Lundh
Calvin Spealman wrote: No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import subprocess p = subprocess.Popen(python,

Re: Subprocess with a Python Session?

2006-12-05 Thread Calvin Spealman
On 12/5/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Calvin Spealman wrote: No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import

Re: Subprocess with a Python Session?

2006-12-05 Thread Shane Hathaway
Calvin Spealman wrote: No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import subprocess p = subprocess.Popen(python,

Re: Subprocess with a Python Session?

2006-12-05 Thread Nick Craig-Wood
Calvin Spealman [EMAIL PROTECTED] wrote: No matter what I do I cant get the following code to do what I expect. I hadn't used subprocess t o read and write to pipes of a still-running app, and I just can't seem to get it right. What gives? import subprocess p =