En Thu, 05 Apr 2007 11:38:06 -0300, Grant Edwards <[EMAIL PROTECTED]> escribió:
> On 2007-04-05, Thomi Aurel RUAG A <[EMAIL PROTECTED]> wrote: > >> The output was: >> --- Start --- >> Pytest write> 02 36 00 01 0a b0 77 >> Pytest write> 02 36 00 01 0a >> Pytest write> b0 77 >> --- END --- > > I'm surprised that the normal file object's write method does > that -- especially for a "binary" file. IMO, it's a bug when a > binary file object treats 0x0a differently than other byte > values. A write() call on a Python file object gets directly translated into a fwrite() C runtime library call. Any special handling is made inside that library. > But, using the file object to read/write a device is > probably not a good idea because of undefined behavior like > that. File objects also do their own buffering, which I > suspect isn't what you want. I agree - using os.open, os.write etc. appears to be the right thing here. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list