Donn Cave wrote:
> I don't recall the beginning of this thread, so I'm not sure
> if this is the usual wretched exercise of trying to make this
> work on both UNIX and Windows,
It is used in "test framework" which runs on Linux, Windows (Cygwin) and
QNX. I can't forget about Windows.
--
http://
Great reply,
I had just mixed Pexpect and subProcess code until I'd got something that
worked, you can actually explain my code better a I can myself. I find it quite
cumbersome to read stdout/strerr separately, and to be able to write to stdin
in reaction to either of them, but at least on Lin
Donn Cave wrote:
> Peter Hansen <[EMAIL PROTECTED]> wrote:
>>Jacek Pop³awski wrote:
>>>My tests showed, that it will block.
>>
>>Not if you use non-blocking sockets, as I believe you are expected to
>>when using select().
>
> On the contrary, you need non-blocking sockets only if
> you don't use
In article <[EMAIL PROTECTED]>,
Peter Hansen <[EMAIL PROTECTED]> wrote:
> Jacek Pop³awski wrote:
> > Grant Edwards wrote:
> >
> >> On 2005-09-12, Jacek Pop?awski <[EMAIL PROTECTED]> wrote:
> >>
> ready = select.select(tocheck, [], [], 0.25) ##continues
> after 0.25s
>
Please note that popen uses pipes, which are block devices, not character
devices, so the writes will be done in blocks instead of characters/lines, (you
can only read something _after_ the application at the other end of the pipe
has done a flush or written 8192 bytes.
When reading from a pty
>>>Jacek Pop*awski <[EMAIL PROTECTED]> 09/13/05 9:23 am >>>
Grant Edwards wrote:
>On 2005-09-12, Jacek Pop?awski <[EMAIL PROTECTED]> wrote:
>
>>> ready = select.select(tocheck, [], [], 0.25) ##continues after 0.25s
>>> for file in ready[0]:
>>> try:
>>>
On 2005-09-13, Jacek Pop?awski <[EMAIL PROTECTED]> wrote:
> Grant Edwards wrote:
>> You're right. I must have been remembering the behavior of a
>> network socket. Apparently, you're supposed to read a single
>> byte and then call select() again. That seems pretty lame.
>
> I created another thr
Grant Edwards wrote:
> You're right. I must have been remembering the behavior of a
> network socket. Apparently, you're supposed to read a single
> byte and then call select() again. That seems pretty lame.
I created another thread with single read(), it works, as long as I have
only one PI
On 2005-09-13, Jacek Pop³awski <[EMAIL PROTECTED]> wrote:
ready = select.select(tocheck, [], [], 0.25) ##continues after 0.25s
for file in ready[0]:
try:
text = os.read(file, 1024)
>>>
>>>How do you know here, that you should read 1024 ch
Jacek Popławski wrote:
> Grant Edwards wrote:
>
>> On 2005-09-12, Jacek Pop?awski <[EMAIL PROTECTED]> wrote:
>>
ready = select.select(tocheck, [], [], 0.25) ##continues
after 0.25s
for file in ready[0]:
try:
text = os.read(file, 102
Only solution which works for now is to redirect stderr to stdout, and
read stdout on thread.
Code without thread or with read() or read(n) (when n>1) can block.
Code with select() and read(1) works, but it is very slow.
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards wrote:
> On 2005-09-12, Jacek Pop?awski <[EMAIL PROTECTED]> wrote:
>
>>>ready = select.select(tocheck, [], [], 0.25) ##continues after 0.25s
>>>for file in ready[0]:
>>>try:
>>>text = os.read(file, 1024)
>>
>>How do you know here, that you
On 2005-09-12, Jacek Pop?awski <[EMAIL PROTECTED]> wrote:
>> ready = select.select(tocheck, [], [], 0.25) ##continues after 0.25s
>> for file in ready[0]:
>> try:
>> text = os.read(file, 1024)
>
> How do you know here, that you should read 1024 characters
The line only means it will read a maximum of 1024 characters, most of the
output I try to catch is much shorter. I think that if the output is longer as
1024, it will read the rest after another call to select.select, but I think I
have not yet come across that case and have not tested it.
I s
> ready = select.select(tocheck, [], [], 0.25) ##continues after 0.25s
> for file in ready[0]:
> try:
> text = os.read(file, 1024)
How do you know here, that you should read 1024 characters?
What will happen when output is shorter?
--
http://mail.python
I was not aware you were using Windows, you might need to find something
similar to select and pty that works in Windows or maybe go though Cygwin, I
don't know. I'm on Linux, the only help I can offer is showing you my working
code, that's a mix of Pexpect, subProcess and Parseltongue.
I'm not
Adriaan Renting wrote:
> Check out the select module, for an example on how to use it:
> pexpect.sourceforge.net
Two problems:
- it won't work on Windows (Cygwin)
- how much data should I read after select? 1 character? Can it block if
I read 2 characters?
--
http://mail.python.org/mailman/listi
Check out the select module, for an example on how to use it:
pexpect.sourceforge.net
>>>Jacek Pop*awski <[EMAIL PROTECTED]> 09/12/05 10:07 am >>>
Popen from subprocess module gives me access to stdout, so I can read
it. Problem is, that I don't know how much data is available... How can
I
Popen from subprocess module gives me access to stdout, so I can read
it. Problem is, that I don't know how much data is available... How can
I read it without blocking my program?
example:
import subprocess
import time
comman
19 matches
Mail list logo