On Wed, Aug 26, 2009 at 8:40 PM, Ryan McGuire<use...@enigmacurry.com> wrote: > On Aug 26, 11:04 pm, Philip Semanchuk <phi...@semanchuk.com> wrote: >> Try using "rb" instead of "r" for the mode in the call to open(). >> >> HTH >> Philip > > That does indeed fix the problem, thanks! Still seems like the docs > are wrong though.
Yeah, the need to specify "b" does seem rather incongruous: codecs.open(filename, mode[, encoding[, errors[, buffering]]]) [...] Note: Files are always opened in binary mode, even if no binary mode was specified. This is done to avoid data loss due to encodings using 8-bit values. This means that no automatic conversion of b'\n' is done on reading and writing. File a bug perhaps?: http://bugs.python.org/ Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list