Re: NamedTemporaryFile does not match documentation

Discussion in 'Python' started by Chris Angelico, Feb 21, 2013.

  1. On Fri, Feb 22, 2013 at 7:46 AM, Jason Friedman <> 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
     
    Chris Angelico, Feb 21, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Friedman
    Replies:
    0
    Views:
    152
    Jason Friedman
    Feb 21, 2013
  2. Serhiy Storchaka
    Replies:
    0
    Views:
    149
    Serhiy Storchaka
    Feb 21, 2013
  3. Jason Friedman
    Replies:
    0
    Views:
    114
    Jason Friedman
    Feb 22, 2013
  4. Chris Angelico
    Replies:
    0
    Views:
    114
    Chris Angelico
    Feb 22, 2013
  5. Jason Friedman
    Replies:
    0
    Views:
    102
    Jason Friedman
    Feb 22, 2013
Loading...

Share This Page