Re: [Tutor] Exception not working as expected?

2019-02-28 Thread eryk sun
On 2/28/19, Chip Wachob wrote: > > Python 2.7 & Windows and also Linux are the platforms being used. Running > the code from the command line / terminal as python except.py. Note that > it does work properly in Linux. So I'm guessing I need to test for a > different exception along with the

Re: [Tutor] Exception not working as expected?

2019-02-28 Thread Alan Gauld via Tutor
On 28/02/2019 21:03, Chip Wachob wrote: > it does work properly in Linux. So I'm guessing I need to test for a > different exception along with the KeyboardInterrupt?? Don't guess, test. Write a single line script raw_input('> ') Run it in a console. Hit Ctrl-C while it waits for input. See

Re: [Tutor] schedulers

2019-02-28 Thread David Rock
> On Feb 28, 2019, at 17:23, Alan Gauld via Tutor wrote: > > On 28/02/2019 14:45, nathan tech wrote: > >> but I'm thinking, should I do this? Honestly, scheduling is the last thing to figure out. As mentioned, it’s probably better to focus on backups and leave the scheduling to the OS tools

Re: [Tutor] schedulers

2019-02-28 Thread Alan Gauld via Tutor
On 28/02/2019 14:45, nathan tech wrote: > but I'm thinking, should I do this? No. fOr several reasons... > def do_backup >  # backup code here, > > def scheduler(): >  global tus # tus=time until schedule > >  while(time.time()>tus): >   time.sleep(5) >  scheduler() scheduler doesn't

Re: [Tutor] schedulers

2019-02-28 Thread Steven D'Aprano
Sorry, I hit send too quick... I realise you haven't written a busy loop, but the way you wrote your scheduler, you can only schedule jobs to the nearest 5 seconds. That's probably okay for a backup process that might take a few hours to run, but it is hardly a good solution to things that

Re: [Tutor] schedulers

2019-02-28 Thread Steven D'Aprano
On Thu, Feb 28, 2019 at 02:45:59PM +, nathan tech wrote: > Hi there, > > I recently started working on a backup program, and the one big feature > everyone wants in backup programs is the ability to schedule backups, right? > > but I'm thinking, should I do this? [...] > Is that wise? Is

[Tutor] Exception not working as expected?

2019-02-28 Thread Chip Wachob
Hello, Python 2.7 & Windows and also Linux are the platforms being used. Running the code from the command line / terminal as python except.py. Note that it does work properly in Linux. So I'm guessing I need to test for a different exception along with the KeyboardInterrupt?? So, the code

[Tutor] schedulers

2019-02-28 Thread nathan tech
Hi there, I recently started working on a backup program, and the one big feature everyone wants in backup programs is the ability to schedule backups, right? but I'm thinking, should I do this? def do_backup  # backup code here, without prints to screen or anything so it just does it in

Re: [Tutor] Remove soft line break

2019-02-28 Thread Valerio Pachera
I think it could be solved in a much easier way. s.replace('\n ', '') In other words removing a new line followed by a space. In such case, the approach is not by line. f = open('file.ics') content=f.read().replace('\n ', '') f.close() The real use case is an .ics file. It works as expected

Re: [Tutor] Remove soft line break

2019-02-28 Thread Valerio Pachera
- Messaggio originale - > Da: "Valerio Pachera" > A: "Tutor Python" > Inviato: Giovedì, 28 febbraio 2019 13:05:27 > Oggetto: Re: [Tutor] Remove soft line break >... > It works as expected but there's a thing I've to understand about the end of > line in general. > ... > I noticed that

Re: [Tutor] ANSI / VT100 Escape Codes in Windows 7 Environment

2019-02-28 Thread Chip Wachob
Wow! What a treasure of information. >From the looks of it, I'm going to give colorama a try. It seems like it will do what I want to do, and, if I'm reading the documentation correctly, it will work cross platform. Ie: if I am in Linux, it will simply be ignored. And, it appears to interpret

Re: [Tutor] Why does using "window.addchr()" to place a character at the lower right corner raise an exception?

2019-02-28 Thread Malcolm Herbert
yes - usually that was the prompt for the terminal to insert a new line ... on some terminals this is a behaviour you can't control as it's implemented in hardware, so curses fakes things by moving the cursor back to where it "should" be afterward. If you try and to something when the cursor