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


Groups > comp.lang.python > #39456

NamedTemporaryFile does not match documentation

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'python': 0.09; 'tempfile': 0.09; 'typeerror:': 0.09; 'subject:not': 0.11; 'writer': 0.16; '>>>': 0.18; 'feb': 0.19; 'import': 0.21; '"",': 0.22; '(most': 0.27; 'subject:skip:d 10': 0.27; 'message-id:@mail.gmail.com': 0.27; 'interface': 0.27; 'lines': 0.28; 'maybe': 0.29; "skip:' 10": 0.30; 'file': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'or,': 0.34; 'along': 0.35; 'does': 0.37; 'to:addr:python.org': 0.39; 'skip:n 10': 0.63; 'more': 0.63; 'skip:n 30': 0.69; 'goal': 0.74; 'subject:skip:N 10': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=OQaW8Moi2FHUJK+KPwD39GXZ9cYnxqFsYWiFPeu0A7g=; b=UmGYFdqOAeOZQQmYSDHcTUlew4u5caodvazqmt2DKyRqe74ElWa1FHTWw9JnWrKiEK ObLCuES55wi/nbk0ghq68XnAq0B0J/WyixtnRK/oQuNMCsp5isPqBAlBqKfMmkT732sQ 2CNymg91zABYt9NLJ52+9LcREq45VdYl08Q7lX8yl6hO+2K++TyzoXbZHhx5N4HcdZqj bCEIsgIppvlf8a1gELj1LcsALD+2/SmiIKH8S8L8Q0RqcV0oFpeZRoJFWvIVi+R2YCm1 CHMtfAZaEFEPgx81nRfeLoBOt5ynOHVyALMt5LSjmQkxOERPPSgRUKfFPNgdb1wKDv4V 6XGw==
MIME-Version 1.0
X-Received by 10.50.195.134 with SMTP id ie6mr12658472igc.6.1361479603280; Thu, 21 Feb 2013 12:46:43 -0800 (PST)
Date Thu, 21 Feb 2013 12:46:43 -0800
Subject NamedTemporaryFile does not match documentation
From Jason Friedman <jsf80238@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2194.1361479605.2939.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361479605 news.xs4all.nl 6960 [2001:888:2000:d::a6]:47605
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39456

Show key headers only | View raw


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)
>>> f
<tempfile._TemporaryFileWrapper object at 0x7f867e8bc050>
>>> f.name
'/tmp/tmpqxnd_4'
>>> f.write("Hello World!\n")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface

Or, maybe I am reading the documentation incorrectly.  My goal is to
be able to write to that temporary file along the lines of "f.write()"
or "with open(f) as writer ...".

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

NamedTemporaryFile does not match documentation Jason Friedman <jsf80238@gmail.com> - 2013-02-21 12:46 -0800

csiph-web