Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39457 > unrolled thread

Re: NamedTemporaryFile does not match documentation

Started byChris Angelico <rosuav@gmail.com>
First post2013-02-22 07:54 +1100
Last post2013-02-22 07:54 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: NamedTemporaryFile does not match documentation Chris Angelico <rosuav@gmail.com> - 2013-02-22 07:54 +1100

#39457 — Re: NamedTemporaryFile does not match documentation

FromChris Angelico <rosuav@gmail.com>
Date2013-02-22 07:54 +1100
SubjectRe: NamedTemporaryFile does not match documentation
Message-ID<mailman.2195.1361480101.2939.python-list@python.org>
On Fri, Feb 22, 2013 at 7:46 AM, Jason Friedman <jsf80238@gmail.com> wrote:
> Python 3.2.2 (default, Feb 14 2012, 08:06:31)
> [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from tempfile import NamedTemporaryFile
>>>> f = NamedTemporaryFile(delete=False)

The default 'mode' is 'w+b', meaning that you need to send it binary,
not Unicode strings. Try adding mode='w+' to the constructor, and
possibly also an encoding= argument.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web