This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ztane
Recipients docs@python, ztane
Date 2016-02-01.17:21:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454347282.51.0.892341568817.issue26261@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for NamedTemporaryFile is a bit vague. It says

[--] That name can be retrieved from the name attribute of the file object. [--] The returned object is always a file-like object whose file
attribute is the underlying true file object. This file-like object can be used in a with statement, just like a normal file.

That `file-like object` vs `true file object` made me assume that I need to do

    f = NamedTemporaryFile()
    f.file.name

to get the filename, which sort of worked, but only later realized that `f.file.name` is actually the file descriptor number on Linux, a.k.a an integer. Thus I suggest that the one sentence be changed to "That name can be retrieved from the name attribute of the returned file-like object."
History
Date User Action Args
2016-02-01 17:21:22ztanesetrecipients: + ztane, docs@python
2016-02-01 17:21:22ztanesetmessageid: <1454347282.51.0.892341568817.issue26261@psf.upfronthosting.co.za>
2016-02-01 17:21:22ztanelinkissue26261 messages
2016-02-01 17:21:22ztanecreate