[New-bugs-announce] [issue11818] tempfile.TemporaryFile example in docs doesnt work

eduardo report at bugs.python.org
Sun Apr 10 09:10:39 CEST 2011


New submission from eduardo <schettino72 at gmail.com>:

>From the example:
 http://docs.python.org/py3k/library/tempfile.html#examples

The error message is weird... but I guess the problem is the default mode 'w+b'.


Python 3.3a0 (default:78a66c98288d, Apr  9 2011, 16:13:31) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> fp = tempfile.TemporaryFile()
>>> fp.write('hello')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface
>>> fp2 = tempfile.TemporaryFile('w+')
>>> fp2.write('hello')
5
>>>

----------
assignee: docs at python
components: Documentation, Library (Lib)
messages: 133447
nosy: docs at python, schettino72
priority: normal
severity: normal
status: open
title: tempfile.TemporaryFile example in docs doesnt work
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11818>
_______________________________________


More information about the New-bugs-announce mailing list