On Wed, 11 Aug 2010 18:49:26 -0700, RG wrote:
> This doesn't explain why "cat | cat" when run interactively outputs
> line-by-line (which it does). STDIN to the first cat is a TTY, but the
> second one isn't.
GNU cat doesn't use stdio, it uses read() and write(), so there isn't any
buffering.
In article ,
Nobody wrote:
> On Wed, 11 Aug 2010 10:32:41 +, Tim Harig wrote:
>
> >>> Usually you either
> >>> need an option on the upstream program to tell it to line
> >>> buffer explicitly
> >>
> >> once cat had an option -u doing exactly that but nowadays
> >> -u seems to be ignored
>
On Wed, 11 Aug 2010 10:32:41 +, Tim Harig wrote:
>>> Usually you either
>>> need an option on the upstream program to tell it to line
>>> buffer explicitly
>>
>> once cat had an option -u doing exactly that but nowadays
>> -u seems to be ignored
>>
>> http://www.opengroup.org/onlinepubs/009695
On 11Aug2010 12:35, Tim Harig wrote:
| > The buffering is a performance choice. Every write requires a context
| > switch from userspace to kernel space, and availability of data in the
| > pipe will wake up a downstream process blocked trying to read.
| > It is far more efficient to do as few suc
In article ,
RG wrote:
> In article ,
> Tim Harig wrote:
>
> > On 2010-08-11, RG wrote:
> > > In article ,
> > > Tim Harig wrote:
> > >
> > >> On 2010-08-11, RG wrote:
> > >> > I'm writing a system in a different language but want to use a Python
> > >> > library. I know of lots of ways
In article ,
Tim Harig wrote:
> On 2010-08-11, RG wrote:
> > In article ,
> > Tim Harig wrote:
> >
> >> On 2010-08-11, RG wrote:
> >> > I'm writing a system in a different language but want to use a Python
> >> > library. I know of lots of ways to do this (embed a Python interpreter,
> >>
On 2010-08-11, RG wrote:
> In article ,
> Tim Harig wrote:
>
>> On 2010-08-11, RG wrote:
>> > I'm writing a system in a different language but want to use a Python
>> > library. I know of lots of ways to do this (embed a Python interpreter,
>> > fire up a python server) but by far the easies
In article ,
Tim Harig wrote:
> On 2010-08-11, RG wrote:
> > I'm writing a system in a different language but want to use a Python
> > library. I know of lots of ways to do this (embed a Python interpreter,
> > fire up a python server) but by far the easiest to implement is to have
> > the
On 2010-08-11, RG wrote:
> I'm writing a system in a different language but want to use a Python
> library. I know of lots of ways to do this (embed a Python interpreter,
> fire up a python server) but by far the easiest to implement is to have
> the main program spawn a Python interpreter and
In article ,
Peter Otten <__pete...@web.de> wrote:
> Grant Edwards wrote:
>
> > On 2010-08-11, Tim Harig wrote:
> >> On 2010-08-11, RG wrote:
> >>> When stdin is not a tty, Python seems to buffer all the input through
> >>> EOF before processing any of it:
> >>>
> >>> [...@mickey:~]$ cat | pyt
In article ,
Cameron Simpson wrote:
> On 11Aug2010 00:11, RG wrote:
> | When stdin is not a tty, Python seems to buffer all the input through
> | EOF before processing any of it:
> |
> | [...@mickey:~]$ cat | python
> | print 123
> | print 456
> | 123
> | 456
> |
> | Is there a way to get P
On 2010-08-11, Peter Otten <__pete...@web.de> wrote:
> Grant Edwards wrote:
>>> If you want to handle stdin a single line at a time from inside of
>>> your program, you can access it using sys.stdin.readline().
>>
>> That doesn't have any effect on stdin buffering.
>
> "for line in stream"-styl
Grant Edwards wrote:
> On 2010-08-11, Tim Harig wrote:
>> On 2010-08-11, RG wrote:
>>> When stdin is not a tty, Python seems to buffer all the input through
>>> EOF before processing any of it:
>>>
>>> [...@mickey:~]$ cat | python
>>> print 123
>>> print 456
>>> 123
>>> 456
>>>
>>> Is there a w
On 2010-08-11, Tim Harig wrote:
> On 2010-08-11, RG wrote:
>> When stdin is not a tty, Python seems to buffer all the input through
>> EOF before processing any of it:
>>
>> [...@mickey:~]$ cat | python
>> print 123
>> print 456
>> 123
>> 456
>>
>> Is there a way to get Python to process input
On 2010-08-11, Cameron Simpson wrote:
> On 11Aug2010 10:32, Tim Harig wrote:
>| On 2010-08-11, Wolfgang Rohdewald wrote:
>| > On Mittwoch 11 August 2010, Cameron Simpson wrote:
>| >> Usually you either
>| >> need an option on the upstream program to tell it to line
>| >> buffer explicitly
>| >
>
On 11Aug2010 10:32, Tim Harig wrote:
| On 2010-08-11, Wolfgang Rohdewald wrote:
| > On Mittwoch 11 August 2010, Cameron Simpson wrote:
| >> Usually you either
| >> need an option on the upstream program to tell it to line
| >> buffer explicitly
| >
| > once cat had an option -u doing exactly that
On 2010-08-11, Wolfgang Rohdewald wrote:
> On Mittwoch 11 August 2010, Cameron Simpson wrote:
>> Usually you either
>> need an option on the upstream program to tell it to line
>> buffer explicitly
>
> once cat had an option -u doing exactly that but nowadays
> -u seems to be ignored
>
> http://ww
On Mittwoch 11 August 2010, Cameron Simpson wrote:
> Usually you either
> need an option on the upstream program to tell it to line
> buffer explicitly
once cat had an option -u doing exactly that but nowadays
-u seems to be ignored
http://www.opengroup.org/onlinepubs/009695399/utilities/cat.html
On 11Aug2010 00:11, RG wrote:
| When stdin is not a tty, Python seems to buffer all the input through
| EOF before processing any of it:
|
| [...@mickey:~]$ cat | python
| print 123
| print 456
| 123
| 456
|
| Is there a way to get Python to process input line-by-line the way it
| does when s
On 2010-08-11, RG wrote:
> When stdin is not a tty, Python seems to buffer all the input through
> EOF before processing any of it:
>
> [...@mickey:~]$ cat | python
> print 123
> print 456
> 123
> 456
>
> Is there a way to get Python to process input line-by-line the way it
> does when stdin is
When stdin is not a tty, Python seems to buffer all the input through
EOF before processing any of it:
[...@mickey:~]$ cat | python
print 123
print 456
123
456
Is there a way to get Python to process input line-by-line the way it
does when stdin is a TTY even when stdin is not a TTY?
Thanks,
21 matches
Mail list logo