Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: NamedTemporaryFile does not match documentation

Reply
Thread Tools

Re: NamedTemporaryFile does not match documentation

 
 
Chris Angelico
Guest
Posts: n/a
 
      02-21-2013
On Fri, Feb 22, 2013 at 7:46 AM, Jason Friedman <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: NamedTemporaryFile does not match documentation Jason Friedman Python 0 02-22-2013 05:57 AM
Re: NamedTemporaryFile does not match documentation Chris Angelico Python 0 02-22-2013 02:42 AM
Re: NamedTemporaryFile does not match documentation Jason Friedman Python 0 02-22-2013 02:10 AM
Re: NamedTemporaryFile does not match documentation Serhiy Storchaka Python 0 02-21-2013 09:30 PM
NamedTemporaryFile does not match documentation Jason Friedman Python 0 02-21-2013 08:46 PM



Advertisments