On Sun, 18 May 2008 22:11:33 -0700, sapsi wrote: > I am using HadoopStreaming using a BinaryInputStream. What this > basically does is send a stream of bytes ( the java type is : private > byte[] bytes) to my python program. > > I have done a test like this, > while 1: > x=sys.stdin.read(100) > if x: > print x > else: > break > > Now, the incoming data is binary(though mine is actually merely ascii > text) but the output is not what is expected. I expect for e.g > > all/86000/114.310.151.209.60370-121.110.5.176.113\n62485.9718 > 118.010.241.12 60370 128.210.5.176 > > However i get a 1 before all and a 4 just after \n and before the 6. > > My question is : how do i read binary data(Java's byte stream) from > stdin? > Or is this actually what i'm getting?
If there's extra data in `x` then it was sent to stdin. Maybe there's some extra information like string length, Java type information, or checksums encoded in that data!? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list