Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102923 > unrolled thread
| Started by | Matt Wheeler <m@funkyhat.org> |
|---|---|
| First post | 2016-02-14 23:58 +0000 |
| Last post | 2016-02-14 23:58 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Make a unique filesystem path, without creating the file Matt Wheeler <m@funkyhat.org> - 2016-02-14 23:58 +0000
| From | Matt Wheeler <m@funkyhat.org> |
|---|---|
| Date | 2016-02-14 23:58 +0000 |
| Subject | Re: Make a unique filesystem path, without creating the file |
| Message-ID | <mailman.119.1455494336.22075.python-list@python.org> |
On 14 Feb 2016 21:46, "Ben Finney" <ben+python@benfinney.id.au> wrote: > What standard library function should I be using to generate > ‘tempfile.mktemp’-like unique paths, and *not* ever create a real file > by that path? Could you use tempfile.TemporaryDirectory and then just use a consistent name within that directory. It's guaranteed not to exist because the directory was only just created and only you can write to it? Has the added bonus of still being reasonably secure, to appease people like Mr PointedEars. (If you need multiple nonexistent paths in the same dir then perhaps use tempfile.NamedTemporaryFile with your newly created temp dir and an arbitrary suffix, and strip the suffix off to get the name you actually use.) -- Matt Wheeler http://funkyh.at
Back to top | Article view | comp.lang.python
csiph-web