Re: [Tutor] sftp in python without using pysftp or paramiko

2018-10-21 Thread Steven D'Aprano
On Sun, Oct 21, 2018 at 12:44:23AM +0100, Alan Gauld via Tutor wrote: > On 20/10/18 21:07, Asad wrote: > > hi All , > > > > I am looking to create a python script which logs in to the server and > > copies the fie from ftp to local system .: > > The obvious answer is use pysftp. > But your

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

2018-10-21 Thread boB Stepp
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 to a unique json filename.

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

[Tutor] Some questions about importlib

2018-10-21 Thread Quentin Agren
Hi, My name Quentin, and this is my first post to this list so please redirect me if this is not the proper audience. I have been studying the 'importlib' standard library package this past week, and although I find it very readable I am puzzled by some questions that I'd like to share. -

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

[Tutor] organisation of folder structure of Python's installation directory

2018-10-21 Thread Malhar Lathkar
Hi all. I am trying to understand how Python's installation directory is organized. I find lib as well as libs folder. what's the difference? I couldn't find exact explanation of purpose of various other sub folders like include, scripts, share etc. Can you help me understand this? Please share

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] Some questions about importlib

2018-10-21 Thread Peter Otten
Quentin Agren wrote: > Hi, > > My name Quentin, and this is my first post to this list so please redirect > me if this is not the proper audience. > > I have been studying the 'importlib' standard library package this past > week, and although I find it very readable I am puzzled by some

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] organisation of folder structure of Python's installation directory

2018-10-21 Thread Mats Wichmann
On 10/21/18 12:52 AM, Malhar Lathkar wrote: > Hi all. > > I am trying to understand how Python's installation directory is organized. > I find lib as well as libs folder. what's the difference? I couldn't find > exact explanation of purpose of various other sub folders like include, > scripts,

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] What is the best way for a program suite to know where it is installed?

2018-10-21 Thread Oscar Benjamin
(Resending to the list - sorry for the duplicate, Bob) On Sun, 21 Oct 2018 at 04:02, boB Stepp wrote: > > I was just re-reading the entire thread at > https://www.mail-archive.com/tutor@python.org/msg77864.html > And I have asked similar questions previous to that thread. I still > do not

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