[Python-3000] TextIOWrapper.write(s:str) and bytes in py3k-struni (original) (raw)
Paul Moore p.f.moore at gmail.com
Tue Jul 17 13:04:13 CEST 2007
- Previous message: [Python-3000] TextIOWrapper.write(s:str) and bytes in py3k-struni
- Next message: [Python-3000] TextIOWrapper.write(s:str) and bytes in py3k-struni
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 17/07/07, Christian Heimes <lists at cheimes.de> wrote:
def write(self, s: str): if self.closed: raise ValueError("write to closed file") if not hasattr(s, 'encode') raise TypeError("str expected, got %r" % s) ...
? It explains what is going wrong.
Surely the error should say that the object passed needs an encode method, rather than that it should be a str?
Paul.
- Previous message: [Python-3000] TextIOWrapper.write(s:str) and bytes in py3k-struni
- Next message: [Python-3000] TextIOWrapper.write(s:str) and bytes in py3k-struni
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]