New submission from Jason S Friedman: Page is http://docs.python.org/3/library/tempfile.html#module-tempfile.
The code in question currently reads: >>> f = NamedTemporaryFile(delete=False) >>> f <open file '<fdopen>', mode 'w+b' at 0x384698> >>> f.name '/var/folders/5q/5qTPn6xq2RaWqk+1Ytw3-U+++TI/-Tmp-/tmpG7V1Y0' >>> f.write("Hello World!\n") >>> f.close() >>> os.unlink(f.name) >>> os.path.exists(f.name) False It should read: >>> import os >>> from tempfile import NamedTemporaryFile >>> f = NamedTemporaryFile(delete=False) >>> f <tempfile._TemporaryFileWrapper object at 0x29bfc50> >>> f.name '/tmp/tmpdxd_85' >>> f.write("Hello World!\n".encode()) 13 >>> f.close() >>> os.unlink(f.name) >>> os.path.exists(f.name) False ---------- assignee: docs@python components: Documentation messages: 182640 nosy: docs@python, jsf80...@gmail.com priority: normal severity: normal status: open title: NamedTemporaryFile expects bytes, not string in documentation for tempfile module versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17271> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com