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 martin.panter
Recipients Adam Dangoor, martin.panter
Date 2017-11-06.12:43:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509972205.18.0.213398074469.issue31959@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation says “On . . . destruction of the temporary directory object the newly created temporary directory and all its contents are removed”. If you had enabled warnings, you may have seen a hint:

$ python -Wdefault -c 'import tempfile; print(tempfile.TemporaryDirectory().name)'
/usr/lib/python3.5/tempfile.py:788: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpj6100h57'>
  _warnings.warn(warn_message, ResourceWarning)
/tmp/tmpj6100h57

This is similar in spirit to earlier bug reports where workarounds were added, but to avoid this instance of the problem the string object returned by the “name” attribute would have to hold a reference back to the directory object.

* Issue 23700: iter(NamedTemporaryFile())
* Issue 18879: NamedTemporaryFile().write(...)
History
Date User Action Args
2017-11-06 12:43:25martin.pantersetrecipients: + martin.panter, Adam Dangoor
2017-11-06 12:43:25martin.pantersetmessageid: <1509972205.18.0.213398074469.issue31959@psf.upfronthosting.co.za>
2017-11-06 12:43:25martin.panterlinkissue31959 messages
2017-11-06 12:43:25martin.pantercreate