Re: Reading all buffered bytes without blocking

2015-03-05 Thread Oscar
In article , wrote: buffer = ('a'*998 + '\u20ac').encode('utf-8')[:1000] buffer.decode('utf-8') >Traceback (most recent call last): > File "", line 1, in >UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 998-999: >unexpected end of data # BOUM hmm... >>>

Re: Reading all buffered bytes without blocking

2015-03-03 Thread Paul Moore
On Tuesday, 3 March 2015 19:29:19 UTC, Serhiy Storchaka wrote: > On 03.03.15 18:07, Paul Moore wrote: > > Is it possible to say to a BufferedReader stream "give me all the bytes you > > have available in the buffer, or do one OS call and give me everything you > > get back"? The problem is that

Re: Reading all buffered bytes without blocking

2015-03-03 Thread Serhiy Storchaka
On 03.03.15 18:07, Paul Moore wrote: Is it possible to say to a BufferedReader stream "give me all the bytes you have available in the buffer, or do one OS call and give me everything you get back"? The problem is that the "number of bytes" argument to read1() isn't optional, so I can't do avai

Reading all buffered bytes without blocking

2015-03-03 Thread Paul Moore
Is it possible to say to a BufferedReader stream "give me all the bytes you have available in the buffer, or do one OS call and give me everything you get back"? The problem is that the "number of bytes" argument to read1() isn't optional, so I can't do available_bytes = fd.read1(). I need this