<div class="gmail_quote">2009/11/7 MRAB <span dir="ltr"><<a href="mailto:python@mrabarnett.plus.com">python@mrabarnett.plus.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div>Baptiste Lepilleur wrote: <br></div></div></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5">


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
[..]<br>
Do I need to replace all codecs.open with the built-in open function? If so, why does codecs.open still exist?<br>
<br>
</blockquote></div></div>
The documentation says of codecs.open() that "Files are always opened in<br>
binary mode, even if no binary mode was specified", but you've given the<br>
mode as 'rt', so you're asking it to open the file both in text mode<br>
_and_ binary mode. This is the same as in Python 2.6.<br>
<br>
If it works in 2.6 but not in 3.1, perhaps it's just that in 2.6 it<br>
ignores the 't' whereas in 3.1 it complains.<br></blockquote><div><br>So I did miss something, but it was in 2.6. Thanks for the clarification. <br><br>Though, I think the documentation is somewhat confusing in 3.x as it says that it opens the file in binary mode, but the opened file iterator returns str not bytes...<br>

</div></div><br>