Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-23 Thread Cameron Simpson
On 23Oct2018 11:24, Peter Otten <__pete...@web.de> wrote: Cameron Simpson wrote: The doco for mktemp (do not use! use mkstemp or the NamedTemporaryFile classes instead!) explicitly mentions using delete=False. Well, "permanent temporary file" does sound odd. By the way, NamedTemporaryFile

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-23 Thread Peter Otten
Cameron Simpson wrote: > On 21Oct2018 10:55, Peter Otten <__pete...@web.de> wrote: >>boB Stepp wrote: >>> So I am now wondering if using >>> tempfile.NamedTemporaryFile(delete=False) would solve this problem >>> nicely? As I am not very familiar with this library, are there any >>> unforeseen

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-22 Thread Wolfgang Maier
On 21.10.18 08:13, boB Stepp wrote: Use case: I want to allow a user of my Solitaire Scorekeeper program to be able to give any name he wants to each game of solitaire he wishes to record. My thought for permanent storage of each game's parameters is to use a dictionary to map the user-chosen

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread Cameron Simpson
On 21Oct2018 10:55, Peter Otten <__pete...@web.de> wrote: boB Stepp wrote: So I am now wondering if using tempfile.NamedTemporaryFile(delete=False) would solve this problem nicely? As I am not very familiar with this library, are there any unforeseen issues I should be made aware of? Would

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread Peter Otten
boB Stepp wrote: > Use case: I want to allow a user of my Solitaire Scorekeeper program > to be able to give any name he wants to each game of solitaire he > wishes to record. My thought for permanent storage of each game's > parameters is to use a dictionary to map the user-chosen game names

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread Cameron Simpson
On 21Oct2018 01:13, boB Stepp wrote: Use case: I want to allow a user of my Solitaire Scorekeeper program to be able to give any name he wants to each game of solitaire he wishes to record. My thought for permanent storage of each game's parameters is to use a dictionary to map the

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread Alan Gauld via Tutor
On 21/10/18 07:13, boB Stepp wrote: > My initial thought was to just have a sequence of game names with > incrementing numerical suffixes: game_0, game_1, ... , game_n. But > this would require the program to keep track of what the next > available numerical suffix is. The traditional approach

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread Quentin Agren
Hi Robert, Far from being an expert, my two cents on this: - As I understand it, you should at least use the 'dir' parameter to NamedTemporaryFile, otherwise your files will be created in a '/tmp/'-like directory that may be wiped clean by the OS now and then. - I seems that the only

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread boB Stepp
On Sun, Oct 21, 2018 at 1:47 AM Quentin Agren wrote: > > Hi Robert, > > Far from being an expert, my two cents on this: > > - As I understand it, you should at least use the 'dir' parameter to > NamedTemporaryFile, otherwise your files will be created in a '/tmp/'-like > directory that may be