Re: [Tutor] How to avoid "UnboundLocalError: local variable 'goal_year' referenced before assignment"?

2019-03-23 Thread boB Stepp
Ah! After another long break from coding, I resume a pattern of one step forward, who knows how many steps back, as I forget what I once remembered and understood. It is the wee morning hours where I am at, so I don't think I will make it through everything, but I will make a start... On Sun, Ma

Re: [Tutor] How to avoid "UnboundLocalError: local variable 'goal_year' referenced before assignment"?

2019-03-23 Thread Cameron Simpson
Discussion below your post here, since I feel I should quote it all: On 23Mar2019 22:15, boB Stepp wrote: I have just written a small program earlier today to allow the user (me) to enter a date by which I wish to finish reading a book (= massive programming-related book) and calculate how many

[Tutor] How to avoid "UnboundLocalError: local variable 'goal_year' referenced before assignment"?

2019-03-23 Thread boB Stepp
I have just written a small program earlier today to allow the user (me) to enter a date by which I wish to finish reading a book (= massive programming-related book) and calculate how many pages I need to read each day (starting today) in order to finish the book by the target date. Looking over

Re: [Tutor] properly propagate problems

2019-03-23 Thread Cameron Simpson
On 23Mar2019 11:04, ingo janssen wrote: One thing I often struggle with is how to deal with exceptions, especially when I have a chain of functions that use each others output and/or long running processes. As the answer will probably be "it depends" Oh yes! The core rule of thumb is "don't

Re: [Tutor] (no subject)

2019-03-23 Thread Mats Wichmann
On 3/23/19 3:16 AM, Peter Otten wrote: > Personally I would use a try...except clause because with that you can > handle invalid dates like _etc.xls gracefully. So > > ERASED = "erased_" > > > def strip_prefix(name): > if name.startswith(ERASED): > name = name[len(ERASED):]

Re: [Tutor] After virtualenv, how to use ide

2019-03-23 Thread boB Stepp
On Sat, Mar 23, 2019 at 12:50 PM anand warik wrote: > > I had installed Python on Ubuntu 14.04 using Anaconda package long back > after failing to install independently for a long time. I was quietly using > it's packaged ide Spyder and had no troubles, in fact I love spider more > then atom. I re

[Tutor] After virtualenv, how to use ide

2019-03-23 Thread anand warik
I had installed Python on Ubuntu 14.04 using Anaconda package long back after failing to install independently for a long time. I was quietly using it's packaged ide Spyder and had no troubles, in fact I love spider more then atom. I recently learned how to setup a virtual environment though, which

[Tutor] properly propagate problems

2019-03-23 Thread ingo janssen
One thing I often struggle with is how to deal with exceptions, especially when I have a chain of functions that use each others output and/or long running processes. As the answer will probably be "it depends" take for example this program flow: open a file and read into BytesIO buffer get a

Re: [Tutor] (no subject)

2019-03-23 Thread Peter Otten
Matthew Herzog wrote: > I have a Python3 script that reads the first eight characters of every > filename in a directory in order to determine whether the file was created > before or after 180 days ago based on each file's name. The file names all > begin with MMDD or erased_MMDD_etc.xls.