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


Groups > comp.lang.python > #102936

Re: Make a unique filesystem path, without creating the file

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Make a unique filesystem path, without creating the file
Date Mon, 15 Feb 2016 15:28:27 +1100
Lines 32
Message-ID <mailman.127.1455510515.22075.python-list@python.org> (permalink)
References <85r3gf55k4.fsf@benfinney.id.au> <CAG93HwHjKewu-VHUUc1jL=cU-pDNxVtKxx6ORyr+mdLLSJx2TA@mail.gmail.com> <CAG93HwGRsvcc=9rGgOA=oi6C-3pTk-Kr3g4dxCN0ivvixTVPWw@mail.gmail.com> <mailman.121.1455494940.22075.python-list@python.org> <56c14ed7$0$11089$c3e8da3@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de LoV6COgID5iqoyKBZ8SYxwoq6bm41PCmEYfyMhSiwztA==
Cancel-Lock sha1:xfTUstmFqcyXmNStQjS+iBr1IbE=
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'paths': 0.05; 'subject:file': 0.07; 'api': 0.09; 'filename,': 0.09; 'filesystem': 0.09; 'implemented,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'security.': 0.09; '2016': 0.16; 'exposes': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'scare': 0.16; 'wrote:': 0.16; 'documented': 0.18; '(not': 0.20; 'library': 0.20; 'cloud': 0.20; 'name;': 0.22; 'help.': 0.23; 'implemented': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'this.': 0.28; 'behaviour': 0.29; 'path,': 0.29; 'unique,': 0.29; "i'm": 0.30; 'entry': 0.31; 'computing': 0.32; 'class': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'library.': 0.35; "isn't": 0.35; 'according': 0.36; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'detail': 0.38; 'end': 0.39; 'why': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'real': 0.62; 'more': 0.63; 'different': 0.63; 'our': 0.64; 'goal': 0.64; 'skip:\xe2 10': 0.70; '8bit%:43': 0.72; '\xe2\x80\x93': 0.72; 'sole': 0.76; '_o__)': 0.84; 'received:125': 0.84; 'touching': 0.84; 'skip:\xe2 30': 0.91; 'subject:Make': 0.91; '8bit%:18': 0.93
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102936

Show key headers only | View raw


Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes:

> On Monday 15 February 2016 11:08, Ben Finney wrote:
>
> > I am unconcerned with whether there is a real filesystem entry of
> > that name; the goal entails having no filesystem activity for this.
> > I want a valid unique filesystem path, without touching the
> > filesystem.
>
> Your phrasing is ambiguous.

The existing behaviour of ‘tempfile.mktemp’ – actually of its internal
class ‘tempfile._RandomNameSequence’ – is to generate unpredictable,
unique, valid filesystem paths that are different each time.

That's the behaviour I want, in a public API that exposes what
‘tempfile’ already has implemented, documented in a way that doesn't
create a scare about security.

> But if you explain in more detail why you want this filename, perhaps
> we can come up with some ideas that will help.

The behaviour is already implemented in the standard library. What I'm
looking for is a way to use it (not re-implement it) that is public API
and isn't scolded by the library documentation.

-- 
 \     “Try adding “as long as you don't breach the terms of service – |
  `\          according to our sole judgement” to the end of any cloud |
_o__)                      computing pitch.” —Simon Phipps, 2010-12-11 |
Ben Finney

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


Thread

Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 11:08 +1100
  Re: Make a unique filesystem path, without creating the file Dan Sommers <dan@tombstonezero.net> - 2016-02-15 01:07 +0000
    Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 12:19 +1100
      Re: Make a unique filesystem path, without creating the file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-15 15:54 +1100
        Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 16:25 +1100
        Re: Make a unique filesystem path, without creating the file Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-15 18:26 -0800
      Re: Make a unique filesystem path, without creating the file Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-15 21:00 +1300
        Re: Make a unique filesystem path, without creating the file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-16 01:18 +0100
      Re: Make a unique filesystem path, without creating the file Grant Edwards <invalid@invalid.invalid> - 2016-02-15 15:49 +0000
  Re: Make a unique filesystem path, without creating the file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-15 15:06 +1100
    Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 15:28 +1100
      Re: Make a unique filesystem path, without creating the file Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-15 21:11 +1300
      Re: Make a unique filesystem path, without creating the file Nobody <nobody@nowhere.invalid> - 2016-02-16 02:14 +0000
    Re: Make a unique filesystem path, without creating the file "Martin A. Brown" <martin@linux-ip.net> - 2016-02-14 20:48 -0800

csiph-web